So, try something like this...
use File::Find; finddepth sub { # finddepth so directories are done AFTER their co +ntents my $old = $_; tr/ /_/ or return; # don't do anything if you don't have spaces -e and return; # don't rename over an existing file! rename $old, $_ or warn "cannot rename $old to $_: $!"; }, "/top/dir/here";
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: rename directories recursively to remove spaces from names
by AltBlue (Chaplain) on Aug 17, 2000 at 18:11 UTC | |
Re: rename directories recursively to remove spaces from names
by fundflow (Chaplain) on May 12, 2003 at 05:25 UTC |