Folder Sync?

Discussion in 'MacBook' started by ms960, Aug 18, 2011.

  1. ms960 macrumors newbie

    Joined:
    Apr 14, 2011
    #1
    New to the Mac world and am trying to do something that should be oh so simple. I want to sync a network share with my Macbook. Should be simple, right? Why am I having such a difficult time finding a utility that will do this, that doesn't cost $40 or more? A simple Google search for similar tools for Windows machines returns a dozen utilities that are freeware or shareware, and many very good (e.g., FreeFileSync, http://freefilesync.sourceforge.net/). Does nobody in the Mac world sync :)?

    Anyway, would greatly appreciate if someone could provide a few links to similar utilities for the Mac, I would greatly appreciate it.

    Thanks!
     
  2. dojonate macrumors newbie

    Joined:
    Aug 18, 2011
    Location:
    Somewhere, over the rainbow
    #2
    Network file sharing

    Try looking under System Preferences -> Sharing -> File/Folder Sharing. If that's what you're looking for, it's built in.
     
  3. ms960 thread starter macrumors newbie

    Joined:
    Apr 14, 2011
    #3
    I found that....not looking for file sharing. I'm looking for a synchronization utility. Thanks though.
     
  4. dojonate macrumors newbie

    Joined:
    Aug 18, 2011
    Location:
    Somewhere, over the rainbow
    #4
    Folder Sync

    In that case, I'd try using Dropbox and the Dropbox servers, in combination with UNIX folder pointers. It's not exactly what you're looking for, but it should get the job done.
     
  5. talmy macrumors 601

    talmy

    Joined:
    Oct 26, 2009
    Location:
    Oregon
    #5
    I sync with Chronosync, which is a paid application. However there is also the command line program rsync that can also be used, which comes on every Mac.
     
  6. unixperience, Aug 18, 2011
    Last edited: Aug 18, 2011

    unixperience macrumors regular

    Joined:
    Jul 21, 2010
    #6
    Actually you can do it with built-in tools!

    we will use automator.... and terminal... well technically

    basically we use automator to monitor the folder, and when there is a change it will run a script to sync files, you don't even have to do anything besides initially set up the automator task!!

    if you use the exact options I have, this script will maintain all access information (users, date accessed, modified, created by, etc), this is important because i also have an option here that will only update files with a later time stamp. so for instance both folders will have a file named text.txt for instance. well when you update it, it will never update overwrite the newer file with an older one, only the other way around

    this will also only copy changed bits! not entire files(unless you change every bit in a file) so after the first time, it will run extremely fast and use very little resources. This is a two step process we need one automator task on your local folder and one on the remote, its easiest this way

    1. open automator (its in the utilities folder)
    2. select folder action
    3. in the new window it will say "folder action recei......" now chose your *local folder*
    4. towards the left hand side of the screen, type in "get specified finder items" and drag it to the large pane on the right, in this new module you just dragged over, select the folder on your *local machine*
    5. now in the search box type in run shell script
    6. in the new window paste in the following script: where source is *local folder* and destination is *remote folder*, also note source has a / after the foldername whereas the destination does not. this is a great resource that helped me with the rsync command, it will be especially helpful with the remote folder part
    http://www.thegeekstuff.com/2010/09/rsync-command-examples/
    anyway the script:
    rsync -avru -progress ABSOLUTE_PATH_TO_SOURCE/ ABSOLUTE_PATH _TO_DEST

    7. save the automator workflow as something descriptive copy_local_to_server, for instance, you can also press the play button to make sure it runs
    8. repeat process replacing *local folder* with *remote folder*

    so the script on the local folder will copy any new changes to the remote one, and when the remote folder changes, it copies any new or changed items to your local machine!!!

    Hopefully all of that made sense, i've included a picture, so that may help a bit, ask questions if you have em :)

    if you need help with the script you can post the path to the files, or if you are uneasy about posting that info, just pm me and i can write the scripts, or help you out
     

    Attached Files:

  7. talmy macrumors 601

    talmy

    Joined:
    Oct 26, 2009
    Location:
    Oregon
    #7
    Haven't tried it, but why do you need the Get Specified Finder Items when rsync will do it's work if passed nothing. In other words, you could just issue the rsync commands from terminal when the folder changes.
     
  8. unixperience macrumors regular

    Joined:
    Jul 21, 2010
    #8
    haha, I was hoping nobody would notice that. but the get finder items is entirely pointless, since the folder action is triggered by the folder, it's not needed.

    It's only in there because automator can't run run folderactions (to test, by pressing the play button) without the "get specified finder items". the script will work fine without it, but you can't test it in automator if that isn't present

    but what you said is true, the rsync will find the folder one its own, the only point of the automator task is so it will run rsync automatically whenever a change is made to the folder

    EDIT: also note that the script in that file syncs both ways (local -> server and sever -> local), but the instructions i wrote only sync one direction at a time. After I created it I realized it was a bit wasteful to do it both ways when one folder changes
     

Share This Page