in reply to How to do a recursive rename ?
This works even if you rename a directory, because the directory gets renamed last.use File::Find; finddepth sub { my $old = $_; return unless -f and s/\.abc$/.def/; warn("won't overwrite existing file at $File::Find::name"), return if -e; rename $old, $_ or warn "Cannot rename $old to $_ in $File::Find::di +r: $!"; }, ".";
-- Randal L. Schwartz, Perl hacker
|
|---|