in reply to Recursive renaming script
Just out of curiosity: why put all your filenames in an array, and then loop through the array to work on them? I'm guessing you did that to get a depth-first traversal, so it wouldn't change a directory name and then be unable to get at the files beneath it. If that's the case, you could use the finddepth() method of File::Find.
Then you could just put the stuff inside your for loop into the sub you're passing to finddepth(). That'd avoid the potential problem of @found filling a lot of memory on a large directory structure, and you wouldn't need to call basename() and dirname() because your callback would already get those values in $File::Find::dir and $_.
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recursive renaming script
by amr noman (Initiate) on Dec 04, 2011 at 15:56 UTC |