From 0b6944c6957dc22d803493448f3fc7cc0ce78ae0 Mon Sep 17 00:00:00 2001 From: Graham Barr Date: Mon, 22 Mar 2004 14:36:51 +0000 Subject: Don'ttry to delete . or .. when doing a recursive delete --- Net/FTP.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Net/FTP.pm b/Net/FTP.pm index 0e31cf3..7aad1a6 100644 --- a/Net/FTP.pm +++ b/Net/FTP.pm @@ -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); -- cgit v1.2.3-24-ge0c7