Created
August 29, 2017 13:37
-
-
Save magicleon94/a4f8b1de81d1f82dcc0e54ebbe0c7318 to your computer and use it in GitHub Desktop.
Renamer for TV series name with structure "Series Name Season XX Episode XX Title"
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 | |
seasonNo=$1 | |
maxNo=$2 | |
if [ "$#" -ne "2" ]; then | |
echo "Illegal number of parameters" | |
echo "Usage: $0 seasonNumber episodeNumber" | |
fi | |
for i in $(eval echo {1..$2}) | |
do | |
# to create dummies for tests: | |
# touch "Nome serie Season $(printf "%02d" $1) Episode $(printf "%02d" $i) Titolo$i.avi" | |
replaced=$(ls | grep "Season 0\?$1 Episode 0\?$i\ ") | |
newName=$(printf "S%02dE%02d.avi" $1 $i) | |
echo "Replacing $replaced with $newName" | |
mv "$replaced" "$newName" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment