Created
August 18, 2023 12:07
-
-
Save podlom/30ce9f2af87ca1d8013944c31d0edc2f to your computer and use it in GitHub Desktop.
Bulk files rename for Ubuntu Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Specify the directory where the files are located | |
directory="/home/user/Videos/2023-08-18" | |
# 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" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment