in reply to Ftp get directory
You will have to parse out the contents of the array into something more useful though. I did it like this:@remotelist = $ftp->ls("-alR");
I hope this helps.for my $line(@remotelist) { if($line =~ m/\<DIR\>/){ next; } # item is a directory elsif($line =~ m/^\n$/){ next; } # item is a blank line (nix type) elsif(length($line) == 0){ next; } # really blank line elsif($line =~ m/^\.\\(.*?):$/) # we have changed directories { $curdir = $1; $curdir =~ s/\\/\//g; # change the direction of the slash $curdir = $parent . $curdir; } elsif($line =~ /(\d{2}-\d{2}-\d{2})\s+(\d{2}:\d{2}..)\s+(\d+)\s+(. +*?)$/) # item is a file { # name date time size; push @{$listing{$curdir}}, [ $4, $1, $2, $3 ]; } else { print "---> UNKNOWN:\n" . length($line) . "\n|$line|\n"; }
|
|---|