Last active
May 28, 2016 02:25
-
-
Save walac/4518306 to your computer and use it in GitHub Desktop.
A simple script to make the .avi and .srt file names of my favorite series equal.
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 | |
if [ $# -gt 0 ]; then | |
basepath="$1" | |
else | |
basepath= | |
fi | |
for i in "${basepath}"*.mkv; do | |
e=$(echo "${basepath}"$i | sed -e 's/.*[Ss][0-9]\+[Ee]\([0-9]\+\).*/\1/') | |
x=$(ls -1 "${basepath}"*[Ss][0-9]*[Ee]$e*.srt) | |
mv "$i" "${x%%.srt}.mkv" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment