Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

How about this?

by Rhose (Priest)
on Sep 14, 2001 at 22:47 UTC ( #112493=note: print w/replies, xml ) Need Help??


in reply to ftp directories

Since you want to remove the directory anyway (and I am going to assume you know the directories will always be empty) maybe you could use the following:

use strict; use Net::FTP; use constant SERVER => 'server.somewhere.com'; use constant USERID => 'anonymous'; use constant PASSWORD => 'my.mail@somewhere.com'; use constant RMTDIR => '/tmp'; my $mFTP; #-- Open the connection $mFTP = Net::FTP->new(SERVER, Debug => 0); $mFTP->login(USERID,PASSWORD); #-- Process the contents $mFTP->cwd(RMTDIR); foreach ($mFTP->ls) { $mFTP->rmdir($_); if ($mFTP->ls($_)) { print $_," is a file...\n"; } else { print $_," *was* a directory...\n"; #-- Add file create code here... } } #-- Close the connection $mFTP->quit;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2019-08-21 03:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?