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

jprint714

macrumors member
Original poster
Feb 21, 2009
37
0
Hi,

I'm trying put together a kind of incremental backup that works as follow: whenever I add an file to a particular folder/subfolders (located on my external HD), I'd like to automatically copy that newly save file from my folder/subfolders (located on my external HD) to my backup HD (located on another external HD), that would mirror the same folder/subfolder structure.

In other words, when I move an new file to my primary storage folders/subfolders, I'd like to copy that new file to be automatically backed up on my back up HD (which will have the same, corresponding folders/subfolders and files).

At first I thought I should do this via Retrospect, but I've also been told that I should do this via Automator, but I'm a novice w/ this app. Is this an appropriate app for this function? If so, what are the suggested steps to do this?

Thank you...
 

hobowankenobi

macrumors 68020
Aug 27, 2015
2,078
883
on the land line mr. smith.
Hey -

Not much help with scripting, but I was wondering why you would not use one of the myriad of sync/backup tools for this?

There are literally dozens of sync/backup tools that do what you describe, including free ones. Unless you want the challenge of scripting it yourself, I would suggest a sync/backup tool.
 

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
Yep, there are plenty of third part apps that can do it. Or you could use a simple Automator folder action (see attached screenshot).

Something like a rsync might be more efficient, but probably a bit much for you if you're not reasonably confident on the command line.
 

Attachments

  • Screen Shot 2015-11-17 at 15.13.37.png
    Screen Shot 2015-11-17 at 15.13.37.png
    81.9 KB · Views: 641

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
I mentioned rsync, so for the sake of completeness...

If you wanted to be a massive show-off then you could use a Launch Agent and rsync. Folders and files are copied on a schedule (of your choosing) and thanks to rsync, only differences are copied (you can tweak options as appropriate) so although the first file sync might take a while, subsequent ones should be quicker.

Make a text file (I use TextWrangler) with the following contents:

Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
   "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>com.myCompany.folderSync</string>
   <key>ProgramArguments</key>
   <array>
      <string>/usr/bin/rsync</string>
      <string>-avz</string>
      <string>/Users/Admin/Desktop/source2/</string>
      <string>/Users/Admin/Desktop/dest2</string>
   </array>
   <key>StartInterval</key>
   <integer>3600</integer>
   <key>KeepAlive</key>
    <true/>
</dict>
</plist>

...and save the file into /Library/LaunchDaemons. Give it a name ending in plist. Convention says that you use your company's name, followed by a name for your daemon like this:

com.myCompany.folderSync.plist

Also, change that in the plist to match. Next set your source and destination folders.

Then choose an interval (in seconds) on which to sync the folders. In my example I've used 3600 seconds - so every hour.

Then, to activate the daemon either restart your Mac or type the following in Terminal:

launchctl load -w /Library/LaunchDaemons/eu.sgsintl.folderSync.plist

I strongly recommend that you read up on Launch Daemons and rsync first though.

Guide to Launch Daemons
http://www.thesafemac.com/scheduling-recurring-tasks/
https://developer.apple.com/library...stemStartup/Chapters/CreatingLaunchdJobs.html

Guide to rsync
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/rsync.1.html
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.