I have a directory full of images:
image0001.png
image0002.png
image0003.png
...
And I would like a one-liner to rename them to (say).
0001.png
0002.png
0003.png
...
How do I do this?
|
If you are using
|
|||||||||||||
|
|
ls *png | while read -r f; do f2="`echo $f | sed -e's/image//'`"; mv $f $f2; done |
|||||||
|
|
This has worked. Perl's rename:
|
|||||||||||||
|
zmvThe zsh shell has a powerful batch rename command called First you need to enable the
The basic syntax is
You can also ask zsh to automatically define
|
|||||||||
|
|
I like Perl so:
You can also use the same pattern for other tasks like copying the files to another directory:
|
|||
|
|
|
I normally use the nice and simple mmv utility for this usecase:
will perform your task. The Make sure to protect the patterns from the shell by quoting. |
|||||
|
|
|||
|
|
thunar -B *.pngfor thunar's bulk-rename gui tool. – dotjoe Aug 25 '10 at 21:26