Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Testing Files and Directories

by fluxion (Monk)
on Apr 26, 2004 at 19:06 UTC ( [id://348304]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://348304]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-26 09:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found