in reply to Re^4: ftp put problem!
in thread ftp put problem!

Get in the habit of using strict and warnings (this would have caught at least one of your problems in the code above). I don't see any reason to use File::Listing here. Use <code></code> tags around your code posted here. Also, I don't get whether you just want to send all files in a directory or it's subdirectories also. Here is something that does just one directory:
#!/usr/bin/perl use strict; use warnings; use Net::FTP; my $host = 'ServerName'; my $ftp = Net::FTP->new($host, Timeout => 1800) or die "Cannot contact + $host: $!"; $ftp->login('ID', 'PWD') or die "Cannot login ($host):" . $ftp->messag +e; my $dir = '/path/to/files'; chdir $dir or die "Can't cd to $dir: $!"; # E.g., all txt files my @files= grep -f, <*.txt>; foreach $file (@files) { $ftp->put($file) or warn "Could not put $file: ".$ftp->message(); } $ftp->quit; exit;