Today I had a directory of images whose file name extensions are .jpeg. I need them as .jpg but I didn’t want to rename them one by one. Here’s how we can change the file extensions in a directory by batch. And by the way, I am on Mac OS El Capitan version 10.11.5 with […]
bash
Bash: rename all files in directory, replacing all hyphens (-) with underscores (_)
I don’t want to waste time doing things manually when I can run a script that will help me save time and effort. When using Linux or Mac command line (bash?), if you want to rename all files in your present directory and replace all hyphens – with underscores _, run this command:
1 |
for f in *-*; do mv "$f" "${f//-/_}"; done |
And […]