Skip to content

Instantly share code, notes, and snippets.

@felipem775
Last active September 12, 2018 00:22
Show Gist options
  • Save felipem775/8d1108a98e7d69adc05d to your computer and use it in GitHub Desktop.
Save felipem775/8d1108a98e7d69adc05d to your computer and use it in GitHub Desktop.
tinymp4 adventure time && archer renamer
#!/bin/bash
BASEDIR="$PWD/.."
for f in "$BASEDIR"/*.mp4
do
fbname=$(basename "$f" .mp4)
SEASON=${fbname:0:2}
FOLDER=$SEASON
if [ "$FOLDER" -eq "00" ];then FOLDER="Extras";fi
EPISODE=${fbname:3:2}
NAME=${fbname:7}
if [ ! -d "$BASEDIR"/$SEASON ]; then
mkdir "$BASEDIR"/$FOLDER
fi
ln "$f" "$BASEDIR/$FOLDER/S${SEASON}E${EPISODE}${NAME}.mp4"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment