Batch rename shell snippet

Posting this as much for myself as for anyone else. It’s basic, but handy to have without having to think about it.

This snippet does batch renaming in the shell In this case, renaming *.bak to *.txt .

for j in *.bak; do mv "$j" "${j%.bak}.txt"; done

Leave a Reply