Cheers Scratuse strict; use warnings; use Net::FTP; my ($ftp); my $host = "xxx.xxx.xxx.xxx"; my $directory = "destination"; my $localDir = "C:\textfiles"; print "Connecting to $host ..."; if ($ftp=Net::FTP->new($host,Timeout=>240)) { print "Successful\n"; print "Logging in ..."; if ($ftp->login("username","password")) { print "Successful\n"; print "Changing Directory to $directory ..."; if ($ftp->cwd($directory)) { print "Successful\n"; print "Transfering Files\n"; &FileSend($localDir); $ftp->quit; } else { print "Failed\n"; } } else { print "Failed\n"; } } else { print "Failed\n"; } ################################################## # Sub Routines ################################################## sub FileSend() { my $dir = shift; if (opendir DIR, $dir) { while (my $file = readdir DIR) { #print "$file\n"; if ($file =~ /txt$/) #finds plain text files { print "Sending htm files $file ... "; if ($ftp->put($file)) { print "Successful\n"; #unlink ($file); # delete file after ftp } else { print "Failed\n"; } } else { next; } } } else { print "Error opening handle\n"; } }
In reply to Re^3: FTP and update files from a list
by Scrat
in thread FTP and update files from a list
by lev36
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |