May 25, 2009
Rename files easily
A lot of people asked me how to rename files easily and fast enough. We all know the command mv which is used to move files but we can use it to rename files as well (which will be the same operation as moving a file into the same directory).
But we do have a command that has the purpose to actually rename a file: rename.
How to use that command. I’ll show with an example.
For example, you want to move all your files that finishes by ‘.JPG’ to ‘.jpg’.
Here’s the command line:
find / -name "*.JPG" -exec rename JPG jpg {} \;
And hop! Another way to make your life on Linux easier and faster!
alti said,
May 28, 2009 at 5:15 am
you don’t need the find 🙂
rename ‘s/\.JPG/\.jpg/’ *.JPG
Karel MALBROUKOU said,
May 28, 2009 at 9:29 am
Good point, but find is here to make the use of rename recursively 😛
I knew the use of the command as
rename ’s/\.JPG/\.jpg/’ *.JPG
, but not working on my system…weird thing :@
Power Home Solar Review said,
January 27, 2010 at 4:13 am
Great site, I will be back. Well done