Last active
January 16, 2016 17:54
-
-
Save chadjvw/8e143d262e94b56946b8 to your computer and use it in GitHub Desktop.
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 | |
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