Bulk files rename shell script for Linux

If you need to make a bulk files rename on Linux you could use the following Bash Shell script:


# Specify the directory where the files are located

# Change to the directory
cd "$directory"

# Iterate over the files matching the pattern and rename them
for file in [0-9]*.mp4; do
    new_filename=$(echo "$file" | sed -E "s/^([0-9]+)\.mp4$/_name-prefix-\1.mp4/")
    mv -v "$file" "$new_filename"

Just replace directory variable value to an actual path to folder with *.mp4 files on your system.

Replace _name-prefix- with a desired file names prefix.

You could use the following Gist: with bulk mp4 files rename shell script.

Check out Video tutorial on how to Bulk files rename in a bash shell script for Linux.