Last active
September 8, 2022 22:05
-
-
Save lene/9409dcb7a07276533d51bab734e6c260 to your computer and use it in GitHub Desktop.
Sync Music dir to Google Drive
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
sudo apt install google-drive-ocamlfuse # to mount google drive as a pseudo fs | |
sudo apt install athena-jot # for generating the list of {A..Z} in fish shell on the fly | |
sudo apt install parallel # to control running jobs in parallel | |
# set up google drive, see https://github.com/astrada/google-drive-ocamlfuse/wiki/Authorization | |
google-drive-ocamlfuse | |
# mount google drive | |
set DRIVE_DIR GoogleDrive | |
google-drive-ocamlfuse ~/$DRIVE_DIR/ | |
set DIRS va spoken mix tape (jot -c 26 a z) \# | |
# using GNU parallel can limit the number of rsync jobs run in parallel | |
set NUM_JOBS 5 | |
parallel --jobs $NUM_JOBS --tag --linebuffer \ | |
rsync -trluhvW --progress --delete --inplace --stats ~/"Music/{}/" ~/"$DRIVE_DIR/Music/{}" ::: $DIRS | |
# alternatively: start all jobs in background at once instead of using GNU parallel | |
for i in $DIRS | |
echo $i | |
# the --inplace option is key so that already present files are not synced | |
# see https://github.com/astrada/google-drive-ocamlfuse/wiki/rsync | |
rsync -trluhvW --progress --delete --inplace --stats ~/"Music/$i/" ~/"$DRIVE_DIR/Music/$i" & | |
sleep 60 # optional to not spam too much output at once | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rsync
performance:rsync
is scanning instead of transferringrsync
processes get temporarily stuck