Last active
January 22, 2023 10:55
-
-
Save jonathas/9f885a3ef4a26fc31c6dd498d4bf7b69 to your computer and use it in GitHub Desktop.
Using Rsync to keep local and external drives synchronized
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 | |
| baseDir=~/Dropbox | |
| externalDriveDir=/Volumes/Expansion | |
| declare -a localDirs=("Documents" "Music" "Photos" "Shared" "Videos") | |
| for dir in "${localDirs[@]}" | |
| do | |
| echo "======================= Synchronizing ${dir} =======================" | |
| rsync -Pranuv --exclude ".DS_Store" $baseDir/$dir/ $externalDriveDir/$dir | |
| done | |
| date > $externalDriveDir/last_sync.txt | |
| echo "======================= Done Synchronizing! =======================" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change "Pranuv" to "Prauv" above in the rsync command (removing the "n") to actually make changes. The "n" means "DRY RUN"