Created
February 19, 2019 06:34
-
-
Save jrgutier/1d850f795f33b3bf3a8923ae677baa1a to your computer and use it in GitHub Desktop.
Clean download directory of Download Station to match what exists in the client
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_DIR="/volume1/media/downloads/" | |
COMMAND="find $DOWNLOAD_DIR -maxdepth 1 ! -path '$DOWNLOAD_DIR' ! -name '@eaDir'" | |
IFS=$'\n'; for i in $(psql -t -A -U postgres -d download -c "SELECT filename from Download_queue"); do COMMAND="$COMMAND ! -name '$i'"; done | |
COMMAND="$COMMAND -exec rm -rf {} \;" | |
eval $COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment