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'.

Cheers,

Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to