Created
November 13, 2020 00:07
-
-
Save a2nt/868dc1c455537e2db51865d95447ef2a to your computer and use it in GitHub Desktop.
Sort uniq file and sync local music library with mobile phone using synching
This file contains 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/sh | |
# Store duplicate file clean up script at /home/tony/bin/dff.py (ref: https://gist.github.com/a2nt/a47451bbe6814336003dcbeefccd5fe7) | |
# Setup synching to receive new files from mobile to /home/tony/Music/Receive at your local PC | |
# Setup synching at PC and Mobile to sync/receive files with /home/tony/Music/Synced | |
# Create folder /home/tony/Music/Synced/Latest to store and sync 30 latest files | |
# Store your music library at /home/tony/Music/Library | |
# Store your favorite Music at /home/tony/Music/Synced | |
# Add this script to crontab | |
# move received files to library | |
/bin/mv /home/tony/Music/Receive/* /home/tony/Music/Library | |
# remove duplicates at the library by name and file hash | |
/home/tony/bin/dff.py --path /home/tony/Music/Library --delete | |
# copy 30 latest files to from the libary to Sync/Latest | |
rm /mnt/data/Music/Synced/Latest/* | |
find /home/tony/Music/Library -type f -printf "%p\n" | sort -rn | head -n 30 | xargs -I {} cp {} /mnt/data/Music/Synced/Latest | |
# remove sync duplicates | |
/home/tony/bin/dff.py --path /home/tony/Music/Synced --delete | |
# ignore existing at the librarry files by name and don't receive them | |
cd /home/tony/Music/Library | |
printf '%s\n' * > /home/tony/Music/Receive/.stignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment