I know some real perl basics, and I've been using this one liner to rename files:
find . -type f -exec perl -e 'rename($_,lc) for @ARGV' {} \;
The find passes a list of files to the perl one liner, which then renames them lowercase -- but whats the {}
for?
The '{}
' argument is part of the "find" command, not the "perl" command.
Per the find man page documentation, the token '{}
' is replaced with the name of the current file being processed so it can be used by the target of the "exec" arguments, which are, in this case, "perl -e ...
".
It comes from find, and will be substituted by the file(s) name found. It will execute perl like:
perl -e 'rename($_,lc) for @ARGV'
filename
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With