Last active
December 3, 2025 14:52
-
-
Save simbo1905/90ce79354fa9b12c875dcf7a3256cf85 to your computer and use it in GitHub Desktop.
how to zip up your /Users/Shared directories to iCloud
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
| # this will only download what is there already | |
| find ~/Library/Mobile\ Documents/com~apple~CloudDocs/ -maxdepth 1 -name "*.zip" -type f | \ | |
| while read -r zipfile; do \ | |
| if [[ ! -f "/Users/Shared/$(basename "$zipfile")" ]]; \ | |
| then echo "Copying $(basename "$zipfile")..." && cp "$zipfile" /Users/Shared/; \ | |
| fi; \ | |
| done; |
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
| # watches for new zip files down if they do not exist | |
| fswatch -o ~/Library/Mobile\ Documents/com~apple~CloudDocs/ | \ | |
| find ~/Library/Mobile\ Documents/com~apple~CloudDocs/ -maxdepth 1 -name "*.zip" -type f | \ | |
| while read -r zipfile; do \ | |
| if [[ ! -f "/Users/Shared/$(basename "$zipfile")" ]]; \ | |
| then echo "Copying $(basename "$zipfile")..." && cp "$zipfile" /Users/Shared/; \ | |
| fi; \ | |
| done; |
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
| cd /Users/Shared && for dir in */; do echo "Zipping $dir..." && ditto -c -k --sequesterRsrc "$dir" ~/Library/Mobile\ Documents/com~apple~CloudDocs/"${dir%/}.zip"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment