in reply to Re: Re: Moving folders using FTP
in thread Moving folders using FTP

This would not get any sub-directories.

Right, but I didn't see that as a requirement from the OP.

I would replace calls to opendir,readdir with a call to File::Find

This is an interesting point because I've never needed to use File::Find before. Just out of curiosity, why is File::Find better than Perl's own opendir & readdir?

Update: Should have phrased the question slightly better. I meant to ask why File::Find would be better than opendir & readdir for reading files from a directory bearing in mind that recursing through a directory was not a requirement.

-- vek --

Replies are listed 'Best First'.
Re: Re: Re: Re: Moving folders using FTP
by Jenda (Abbot) on Apr 06, 2003 at 21:11 UTC

    It's not better. It's something else. readdir() gives you the files in a single directory. File::Find gives you all files in a tree.

    If the question was "why is File::Find better than recursing through the directory tree oneself using opendir() and readdir()" ... I'd say ... because it's well tested and maintained. You may reinvent the wheel if you feel like it I don't find it necessary.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

      Thx Jenda, I should have phrased my question about File::Find a little better.

      -- vek --