Code: Select all
#!/bin/bash
# Assumes that newly-finished torrent files are automatically
# moved to the SEEDING directory
# directory of finished torrents that are seeding
SEEDING=/mnt/Vault/Seeding/
# blacklist
BLACKLIST=/mnt/Vault/Finished/blacklist.txt
# where to move files for archival staging
# files can be edited and removed from this folder
# whithout affecting seeding copy
FINISHED=/mnt/Vault/Finished/
# for each file or folder in the SEEDING directory,
# check if it's on the blacklist
# if it is not, then recursively copy it to FINSIHED
# and add it to the blacklist
cd $SEEDING
echo Copying files from Seeding directory to Finished Directory...
for file in *
do
COUNT=`grep -cF "$file" $BLACKLIST`
if [ $COUNT == 0 ]; then
echo $file
cp -r "$file" $FINISHED
echo "$file" >> $BLACKLIST
fi
done