Skip to content

Instantly share code, notes, and snippets.

@woodRock
Last active September 17, 2019 05:48
Show Gist options
  • Save woodRock/f9d26b2cf39e89b79b931759b539f9ed to your computer and use it in GitHub Desktop.
Save woodRock/f9d26b2cf39e89b79b931759b539f9ed to your computer and use it in GitHub Desktop.
Rename a episodes in a folder for a season
a=1
for i in *.mkv; do
placeholder=""
if [ "$a" -lt 10 ]
then
placeholder="0"
fi
new=$(printf "Episode-%s%d.mkv" "$placeholder" "$a")
mv -i -- "$i" "$new"
let a=a+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment