Recently, I had to bulk rename about 50 file names in bulk on Ubuntu 14.04 LTS (Linux) and I was having a difficult time in finding a proper way to do this without the need for additional software. I checked out “Renamer” which is a good option if you would like to keep strings of text inside the original file name or for the more complicated bulk renaming. But in the end I found a good Bash script to get the work done.
All it does is change all jpg files in the current directory into a numerical progression from 1 to x.
Here is the bash script to bulk rename multiple file names (use Terminal in Linux):
#!/bin/sh num=1 for file in *.jpg; do mv "$file" "$(printf "%u" $num).jpg" let num=$num+1 done
You can even add more information to your file names by changing the line:
mv "$file" "$(printf "%u" $num).jpg"
Just replace “filename” into whatever you need:
mv "$file" "filename-$(printf "%u" $num).jpg"
Good luck!
Recent Comments