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";
In reply to rename directories recursively to remove spaces from names by merlyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |