#!/usr/bin/perl -w use strict; use File::Find; my $dir = '.'; # or wherever finddepth(\&myrename, $dir); sub myrename { return unless -d; # if you only care about dirs return unless / /; my $oldname=$_; s/ /_/g; return if ($oldname eq $_); if (rename $oldname,$_) { print "renamed $File::Find::name to $_\n"; } else { warn "Couldn't rename $File::Find::name to $_: $!"; } }
In reply to Re: rename directories
by fundflow
in thread rename directories
by ashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |