in reply to How can I opendir, replace all files containing a space with .?

This is a bit overkill for just renaming files in a directory, but if you want to rename files in a directory and all subdirectories (or rename directories also), you can modify the first two lines of the sub:
use File::Find; my @dirs = qw(.); find( sub{ return if $File::Find::name eq $File::Find::topdir; $File::Find::prune=1, return if -d; if ((my $newname = $_) =~ tr/ /./) { print "Renaming $File::Find::name to $newname\n"; rename $_, $newname or die "Can't rename $_: $!"; } }, @dirs);
  • Comment on Re: How can I opendir, replace all files containing a space with .?
  • Download Code