Skip to content

Instantly share code, notes, and snippets.

@dustinknopoff
Created April 17, 2018 18:58
Show Gist options
  • Save dustinknopoff/4434662c2807255ace21b78efff45247 to your computer and use it in GitHub Desktop.
Save dustinknopoff/4434662c2807255ace21b78efff45247 to your computer and use it in GitHub Desktop.
NAS and External Hard Drive sync example using rsync and Automator
  1. Create Automator Folder Action.
  2. Add Folder to watch.
  3. In Picker, enter CMD + SHIFT + G and type /Volumes/
  4. Click Choose.
  5. Add Run Script to Automation.
  6. Use /bin/bash or /bin/zsh.
  7. Example rsyncs:
#!/usr/bin/env bash

rsync -av -P --ignore-existing /Users/Dustin/Library/Lima/Desktop/ /Volumes/Seagate\ Backup/Desktop

rsync -av -P --ignore-existing /Users/Dustin/Library/Lima/Documents/ /Volumes/Seagate\ Backup/Documents

rsync -av -P --ignore-existing /Users/Dustin/Library/Lima/Pictures/ /Volumes/Seagate\ Backup/Pictures

Lima is the folder for my NAS and Seagate\ Backup is for my external hard drive.

-P shows the files being synced.

--ignore-existing does not sync files that already exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment