bash – Batch Renaming Files

bashrenameshell

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?

Best Answer

If you are using Bash or other POSIX-compatible shell:

for f in *.png; do
    mv -- "$f" "${f#image}"
done
Related Question