Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Renaming all files in a directory

by choroba (Cardinal)
on Feb 02, 2021 at 13:19 UTC ( #11127812=note: print w/replies, xml ) Need Help??


in reply to Renaming all files in a directory

If you don't want to use Perl's glob, use the shell's globbing instead of parsing the output of ls.
perl -we 'rename $_, "image" . $counter++ . ".jpg" for @ARGV' *
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2022-12-05 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?