rsync syntax help

Discussion in 'macOS' started by kirby42, May 22, 2010.

  1. kirby42 macrumors newbie

    Joined:
    May 22, 2010
    #1
    Hello all. I'm trying to understand rsync and os x's sytax enough to write a little script, but my brain is refusing to work...

    I want to have my laptop recognize my flash drive, bidirectionally sync it with a folder on my desktop with rsync, then eject the drive. Playing a sound afterwards would be neat. :)

    So.... help? Thanks.

    Oh, and no "go get this program blah blah blah". There is a massive CLI and no reason to install pointless one use programs. :)
     
  2. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #2
    Just type man rsync in the terminal, you'll get the explanation and also what flags there are and how to use them
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    Doing a "man rsync" will give you the manual. The basic pieces though are

    Code:
    rsync --archive --update /path/to/source /path/to/destination
    then switch the paths to sync the opposite direction. The --update is key because it will skip files that are newer on the destination. The --dry-run argument will do a test run, which could be handy.

    To have the script speak use the say command.
    Code:
    say "Synchronization complete!"
     

Share This Page