in reply to Testing Files and Directories

-e will test true if the file exists, and it'll also return false if the target exists, but isnt a file (directory). The same holds true for -d with respect to directories. Using these, your code would be written as follows:
@files = $ftp->ls; foreach $file1 (@files) { next if(-e $file1); # skip non-directories if(-d $file1) { $ftp->get($file1) || die "Can't get files from $dir :@{[ $ftp->message ]}\n"; } } $ftp->close();

Roses are red, violets are blue. All my base, are belong to you.

Replies are listed 'Best First'.
Re: Re: Testing Files and Directories
by Joost (Canon) on Apr 26, 2004 at 19:25 UTC
      whoops. yah, looks like the best method would be to parse the output of ls -l, as suggested by the first reply.

      Roses are red, violets are blue. All my base, are belong to you.

        that's a ++ vote for the signature alone. Dude!