← back to notes

Bash rename files 1 liner

Jan 1, 2024

Building this website, I found out images are better being served from the nextjs server, instead of from my cloud image hosting.

So I had to rename all the images, because they had weird names as they were downloaded from google photos.

To rename each car image, if you are just looking for 1.webp, 2.webp, etc, you can use this command:

counter=1; for file in *.webp; do mv "$file" "$counter.webp"; ((counter++)); done