Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 853
user1354603 Avatar asked Nov 15 '13 09:11

user1354603


1 Answers

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

like image 133
user1354603 Avatar answered Sep 28 '22 05:09

user1354603