Bulk rename of files script

A quick script I have made to bulk rename a set of files in a directory.

This script was built around the requirement of having a large volume of files in the /root/pictures/ directory – named with the naming format july-123.jpgwhich I wished to rename to holiday-123.jpg (Though you can adjust the below as required to achieve your required outcome).

mkdir /scripts/
nano /scripts/bulk-rename

for f in /root/pictures/july*; do
a=”$(echo $f | sed s/july/holiday/)”
mv “$f” “$a”

chmod +x /scripts/bulk-rename

You should now be able to run this script as below, which will go through and bulk rename all of your files starting with july to holiday. (eg holiday-123.jpg)

Any comments or questions? Get in touch here or Email me at [email protected]