> Dan Muey wrote: > > > > What I'd like to do is simply: > > > > (WHERE exists() is hopefully a solution to my first question) > > > > > > > > if($ftp->exists($file)) { > > > > $ftp->delete($file); > > > > if($ftp->exists($file)) { print "Could not delete > $file"; } else { > > > > print "$file is all gone"; } } else { print "$file does > > > not exist so > > > > I did not even try to delete it" } > > > > > > 'size' is the way to do it, but remember that it will return zero > > > for a file of zero size. What you need is 'defined'. > > > > > > This little subroutine will fulfil your wishes and make the code > > > above work. > > > > > > sub Net::FTP::exists { > > > my $ftp = shift; > > > defined $ftp->size(@_); > > > } > > > > > > HTH, > > > > As always Rob a huge help. I'll play around with that. > > It's makes so much sense when you think about it! > > I'll tuck that one away under my big hat too! > > > > Glad to help. FTP's a pain: as far as I know there's no way > of telling whether a filename is a plain file or a directory > either, without either trying to 'cwd' to it or parsing the > output or 'dir'. >
Maybe that could me my first module! Net::FTP::Stat or ::File or ::Info or something that one could do your exists() #1 or 0 And maybe I could come up with isfile() #1 or 0 isdir() # 1 or 0 parsedir() # hash ref that has the file name as the key and a hash ref to hash of key => value stuff that parses 'dir' I'll have to see if there is such a thing, I bet there is. Just blabbering now... Anywho, thanks Rob you rock! > Cheers, > > Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]