Problem: A client sent me 164 images with incorrect extensions on them. I needed to change them all from .jpg to .png.
Fix: Open up terminal, navigate to the directory containing all the images and type:
ls *.jpg | awk '{print("mv "$1" "$1)}' | sed 's/jpg/png/2' | /bin/sh
..that should do it! This one-liner makes use of sed and awk unix utilities.
Leave a Reply