Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

How about this?

by Rhose (Priest)
on Sep 14, 2001 at 22:47 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://112493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found