diff options
author | Graham Barr <gbarr@pobox.com> | 2004-03-22 14:36:51 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2009-02-24 08:51:37 -0600 |
commit | 0b6944c6957dc22d803493448f3fc7cc0ce78ae0 (patch) | |
tree | 2b502fcd508809638b586abae1e976e5b648d6a7 | |
parent | b01919ce94068f5018719b1785c97162c35e2fcf (diff) | |
download | perl-libnet-0b6944c6957dc22d803493448f3fc7cc0ce78ae0.tar.gz |
Don'ttry to delete . or .. when doing a recursive delete
-rw-r--r-- | Net/FTP.pm | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -593,14 +593,14 @@ sub rmdir # Try to delete the contents # Get a list of all the files in the directory - my $filelist = $ftp->ls($dir); + my @filelist = grep { !/^\.{1,2}$/ } $ftp->ls($dir); return undef - unless $filelist && @$filelist; # failed, it is probably not a directory + unless @filelist; # failed, it is probably not a directory # Go thru and delete each file or the directory my $file; - foreach $file (map { m,/, ? $_ : "$dir/$_" } @$filelist) + foreach $file (map { m,/, ? $_ : "$dir/$_" } @filelist) { next # successfully deleted the file if $ftp->delete($file); |