Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

(zdog) Re: (2) how to rename all files in a dir

by zdog (Priest)
on Jul 07, 2002 at 15:49 UTC ( #179983=note: print w/ replies, xml ) Need Help??


in reply to (jeffa) Re: how to rename all files in a dir
in thread how to rename all files in a dir

In case there is no specified file extension like .txt, something like this can be done:

perl -e 'for (grep {-f} <*>) { rename $_, sprintf("%02d%s", ++$i, $_) }'

Zenon Zabinski | zdog | zdog@perlmonk.org


Comment on (zdog) Re: (2) how to rename all files in a dir
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2014-09-30 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (363 votes), past polls