As far as I can determine, the Net::FTP::rmdir function, even with the "recurse" flag on, cannot handle
the removal of directories containing subdirectories whose name begins with ".".
For example, suppose I have the following directory structure:
remove_me
.hidden
fooWhat I find is that I can't get Net::FTP::rmdir to remove this directory. (Sample code included below)
Has anybody run into this, or can anyone suggest a fix, alternate module, or whatever?
Thanks,
Ted Gilchrist
---------------
use FindBin(qw($Bin));
use lib $Bin; use lib "$Bin/../lib";
use Net::FTP;
my $MY_TEST_DIR = "remove_me"; #my $MY_TEST_DIR = "remove_me2";
my $machine = "goober";
my $ftp = Net::FTP->new("$machine", Debug => 1) ||
die "New ftp object creation failed" if (!$result);$ftp->login("anonymous", "egilchri") || die "Could not login to $machine";
$ftp->binary();
$ftp->cwd("pub");
my $still_there = exists_directory($ftp, $MY_TEST_DIR);
if ($still_there){
$ftp->rmdir($MY_TEST_DIR, 1);
}die "The directory $MY_TEST_DIR was not removed" if (exists_directory($ftp, $MY_TEST_DIR));
$ftp->quit;
sub exists_directory{ my ($ftp, $file) = @_;
my $here = $ftp->pwd();
my $result = $ftp->cwd($file);
$ftp->cwd($here); # change back
if ($result){
return 1;
}
return 0;}
_______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

