Skip to content

Instantly share code, notes, and snippets.

@chadjvw
Last active January 16, 2016 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadjvw/8e143d262e94b56946b8 to your computer and use it in GitHub Desktop.
Save chadjvw/8e143d262e94b56946b8 to your computer and use it in GitHub Desktop.
#! /bin/bash
download="/mnt/vol/media/Downloads/"
mov="/mnt/vol/media/Movies/"
for x in {A..Z}; do
find $download -not -path "*tv*" -iname ""$x"*.m??" -not -iname "*sample*" -or -not -path "*tv*" -iname ""$x"*.avi" -not -iname "*sample*" | while read d;
do
p=$(basename "$d")
r=$(dirname "$d")
if [ "${p:0:3}" == "The" ]; then
nextL="${p:4:1}"
if [ -f "$mov$nextL/$p" ]; then
echo "Movie found. Skipping copy for "$p"."
else
echo "Copying $p"
cp "$d" $mov$nextL
fi
# rm -rf "$r"
else
if [ -f "$mov$x/$p" ]; then
echo "Movie found. Skipping copy for "$p"."
else
echo "Copying $p"
cp "$d" $mov$x
fi
# rm -rf "$r"
fi
done
done
for x in {0..9}; do
find $download -not -path "*tv*" -iname ""$x"*.m??" -not -iname "*sample*" -or -not -path "*tv*" -iname ""$x"*.avi" -not -iname "*sample*" | while read d ;
do
p=$(basename "$d")
r=$(dirname "$d")
if [ -f "$mov"0-9"/$p" ]; then
echo "Movie found. Skipping copy for "$p"."
else
echo "Copying $p"
cp "$d" $mov"0-9"
fi
# rm -rf "$r"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment