Created
January 31, 2022 00:36
-
-
Save EduardoThums/ad05ee8aac5f951c7837cd3f4aaff22c to your computer and use it in GitHub Desktop.
Normalize MP4 files to a more human readable format.
This file contains hidden or 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 | |
| RENAME_FOR_REAL=$1 | |
| SAVEIFS=$IFS | |
| IFS=$(echo -en "\n\b") | |
| for f in *.mp4 | |
| do | |
| new_file=$(echo $f | grep --ignore-case -E 'ep-[0-9]*' -o | tr '[:upper:]' '[:lower:]') | |
| echo "Renaming '$f' to '$new_file'" | |
| if [[ -n $RENAME_FOR_REAL ]]; then | |
| mv "$f" "$new_file.mp4" | |
| fi | |
| done | |
| IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment