Moving files
Kevin D. Clark
kclark at CetaceanNetworks.com
Mon Jan 6 12:44:07 EST 2003
pll at lanminds.com writes:
> perl -e 'opendir DIR,".";@f = grep { ! /^\./ && -f $_ } readdir(DIR);\
> map {($n = $_)=~ s/\s+/_/g; rename ($_, $n) } @f;'
Things that come to mind when I see this:
1: this code doesn't recurse.
2: this code skips over files with a name that begins with ".".
(". foo" doesn't get touched)
3: this code doesn't rename directory names with spaces (I have quite
a few MP3 directories like this -- I don't know if this is
important to the original poster or not).
Regarding the various comments that this is unreadable: I disagree,
but everybody is entitled to their opinion.
Regards,
--kevin
--
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc
More information about the gnhlug-discuss
mailing list