Moving files
Michael O'Donnell
mod+gnhlug at std.com
Mon Jan 6 11:32:55 EST 2003
> perl -e 'opendir DIR,".";@f = grep { ! /^\./ && -f $_ } readdir(DIR);\
> map {($n = $_)=~ s/\s+/_/g; rename ($_, $n) } @f;'
Heh. Just for fun I rot13'd that Perl hack and, for my money,
it's just as readable... ;->
crey -r 'bcraqve QVE,".";@s = terc { ! /^\./ && -s $_ } ernqqve(QVE);\
znc {($a = $_)=~ f/\f+/_/t; eranzr ($_, $a) } @s;'
On a more serious note, I (for one) would be grateful for
a blow-by-blow analysis of what you've done, since I'm in
trying to learn how to look at Perl code without my eyes
automatically crossing...
(Same for Kevin's solution, if you please...)
More information about the gnhlug-discuss
mailing list