perl - how do I list contents of local directory on ftp? -
i trying send files remote host via perl script. want list local directory choose files upload iterate through files list using following commands:
my @files = '!ls'; not work @files = 'lls'; not work either
then want do:
foreach $file (@files) { next if -d $file; next unless $file =~ /^gateway_data/; $ftp->put($file) or warn "failed '$file': $! ($^e)"; }
is there command, apart 2 above, make list of files in local directory? assistance appreciated.
opendir(my $dir, './') or die $!; @files = readdir($dir); foreach $file (@files) { next if -d $file; next unless $file =~ /^gateway_data/; $ftp->put($file) or warn "failed '$file': $! ($^e)"; }
this should work.
Comments
Post a Comment