opendir (DIR, $some_dir) || die "opendir: $!\n"; for my $file_found (readdir DIR) { my $full_path = $some_dir . "/" . $file_found; next if (-d $full_path); $ftp->put($full_path) || die "put: $!\n"; }