Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kirby42

macrumors newbie
Original poster
May 22, 2010
1
0
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. :)
 
Just type man rsync in the terminal, you'll get the explanation and also what flags there are and how to use them
 
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!"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.