Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Rename FILE to nnn-FILE

by BrowserUk (Patriarch)
on Dec 30, 2004 at 03:01 UTC ( [id://418161]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://418161]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found