Skip to content

Instantly share code, notes, and snippets.

@42jerrykim
Last active July 20, 2019 00:56
Show Gist options
  • Save 42jerrykim/a6724b699dbed6c7cf79964450e31ac7 to your computer and use it in GitHub Desktop.
Save 42jerrykim/a6724b699dbed6c7cf79964450e31ac7 to your computer and use it in GitHub Desktop.
COMPLETED_FILE_DIR="/mnt/external_drive/rutorrent/downloads/completed/"
TEMP_FILE_DIR="/mnt/external_drive/Torrent/"
echo "##### Moving #####"
find ${COMPLETED_FILE_DIR}/ -maxdepth 1 -mtime +16 -exec sh -c "ls -ldh \"{}\" && mv \"{}\" \"${TEMP_FILE_DIR}\"" \;
echo "##### Copying #####"
find ${TEMP_FILE_DIR} -name "*.mkv" -exec sh -c "ls -ldh \"{}\" && rclone move \"{}\" gdrive_rclone:/Torrent -P;" \;
find ${TEMP_FILE_DIR} -name "*.srt" -exec sh -c "ls -ldh \"{}\" && rclone move \"{}\" gdrive_rclone:/Torrent -P;" \;
find ${TEMP_FILE_DIR} -name "*.smi" -exec sh -c "ls -ldh \"{}\" && rclone move \"{}\" gdrive_rclone:/Torrent -P;" \;
find ${TEMP_FILE_DIR} -name "*.mkv" | grep mkv && { echo Error; } || { echo Done; rm -rf ${TEMP_FILE_DIR}/*;}
echo "##### Done #####"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment