in reply to Renaming Sub Dir/Files.
I believe you are right about the -d $fname thing, try this:
if ( -d "$path/$fname" ) {
Also, on a nit-picky note, if you have really big directories, it is more efficient to do a readdir one at a time then to slurp it all into an array
opendir(DIR, $path); @files = readdir(DIR); $ct = 0; while ($fname = readdir(DIR)) { ... # Damian Conway's 'yada, yada, yada' operator :) } closedir(DIR);
Addendum: The same reason that your -d test is not working applies to your renaming problem. As you can see from your output, readdir doesn't return the path, only the filename. You'll probably need to include full paths with your rename() args.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Renaming Sub Dir/Files.
by TheDamian (Vicar) on Dec 20, 2001 at 05:29 UTC | |
|
Re(2): Renaming Sub Dir/Files.
by dmmiller2k (Chaplain) on Dec 17, 2001 at 21:41 UTC |