Skip to content

Instantly share code, notes, and snippets.

@simbo1905
Last active December 3, 2025 14:52
Show Gist options
  • Select an option

  • Save simbo1905/90ce79354fa9b12c875dcf7a3256cf85 to your computer and use it in GitHub Desktop.

Select an option

Save simbo1905/90ce79354fa9b12c875dcf7a3256cf85 to your computer and use it in GitHub Desktop.
how to zip up your /Users/Shared directories to iCloud
# 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;
# 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;
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