in reply to renaming subdirectories on MS Windows

momo33:

You'll probably have to cache the renames, and do them after you've traversed the directory tree since Windows isn't going to want to let you rename a directory when a process is using it. Something like this:

my @renames; ... sub wanted { ... push @renames, [ $old_name, $new_name ]; ... } ... find(...); for (@renames) { move $$_[0], $$_[1]; }

You may be able to do it using the no_chdir option on File::Find, but I don't know. (File::Find may have the directory open anyway as part of how it works.)

...roboticus

Update: Fixed missing code tag.

Replies are listed 'Best First'.
Re^2: renaming subdirectories on MS Windows
by momo33 (Beadle) on Nov 03, 2010 at 21:02 UTC
    This seems to work: thank you!