in reply to Rename FILE to nnn-FILE

As a "one-liner" (with caveats), this would do the trick:

perl -wle "$x='000'; $x++ and $o=$_ and s[/(.*$)][/$x-$1] and rename($ +o,$_) or warn $! for glob qq[$ARGV[0]/*]" dir

but trying to remember how to type that is too hard, so you'd want to make it a script, at which point your original is much nicer.


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.