user1354603 user1354603 - 6 months ago 33
iOS Question

Batch rename in OSX, add @2x to all files ending with .png

I would like to rename my images from .png to @2x.png. Is there some easy way to do this with the terminal?

Answer

With the help of Mark Setchell's answer I was able to solve this with the following one-liner:

for f in *.png; do NEW=${f%.png}@2x.png; mv ${f} "${NEW}"; done;

Edit: flopr was right, should work now