in reply to Directory recursion on win32

Is there a reason you aren't using File::Find?

Abigail

Replies are listed 'Best First'.
Re: Re: Directory recursion on win32
by fourmi (Scribe) on Aug 04, 2003 at 14:21 UTC
    Hi,
    Really REALLY swift responses, so for now i'll assume you are boths scripts ;)
    The test tree is about 4 directories deep, and contains about 50 files, some directories merely contain subdirs, and some nothing at all.

    As far as a reason why I am not using File::Find the reason would be ignorance. I have constructed something similar to this script which worked fine in unix, but am having probs, in win32. I just stuck with the same method. The unix scripts can be cut and pasted if you think it would be of any help.

    cheers again
    ant
      The script for the sake of simplicity will add a trailing 'z' to all files and directories... As far as a reason why I am not using File::Find the reason would be ignorance

      Then perhaps this will help to rectify that:

      use File::Find; sub rename_file { my $fullpath = $File::Find::name; rename ($fullpath, $fullpath.'z') || warn "Failed to rename $fullpath\n"; } find (\&rename_file, $path);
      What could be simpler?

      As others have pointed out, modules are there to help you. Not using them out of ignorance is probably not what you want to do for too long: you miss out on all the fun!