Basic sync recipe

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Basic sync recipe Thu Jul 12, 2012 3:17 pm • by JohnBurridge
Okay, so I'm trying to make a basic sync routine but Hazel seems to be asleep at the sync wheel. The scenario I'm looking for is that when I load or delete images from my camera(or via Aperture) on my machine's main hard drive, I want Hazel to make a sync/backup copy on my drobo. When I delete from my main hard drive, I want Hazel to delete the files on the Drobo and so on.

I seem to have to force Hazel to run the script(which will then complete successfully), even though it's a watched folder. I thought this would be a simple process, but so far I'm defeated.

Thanks in advance!
JohnBurridge
 
Posts: 5
Joined: Thu Jul 12, 2012 3:10 pm

Re: Basic sync recipe Thu Jul 12, 2012 4:36 pm • by a_freyer
A bit more detail...

What did you try that didn't work?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Basic sync recipe Thu Jul 12, 2012 8:22 pm • by JohnBurridge
This is a screen cap of what I've attempted.

I'm unclear as to the "all of its sub-files and folders" setting does, though I've tried fiddling with that one but I don't think I was any better off.

Also, some of my instructions may be redundant...


Image
JohnBurridge
 
Posts: 5
Joined: Thu Jul 12, 2012 3:10 pm

Re: Basic sync recipe Fri Jul 13, 2012 3:03 pm • by Mr_Noodle
Here's a basic sync rule. It looks complicated but that's because it's very complete.

The first thing you should know is that if you want to sync a folder and all its contents, you need to have Hazel monitor the folder containing that folder you want to sync. Then you create a rule to match the folder you want to sync. In the rule I've attached, it matches against a folder named "blah". Change that to suit your situation.

The rule then matches if (a) the folder itself has changed or (b) any of its subfiles has changed. As a result, this will do a sync every time anything is modified. If it's a big folder tree, you may want to add a condition to do it less frequently, like "Date matched is not in the last 10 minutes", so that it doesn't bog things down. Alternatively, you can sync on a schedule using the Current Time attribute and get rid of all the conditions relating to date modified.

sync.hazelrules
(3.77 KiB) Downloaded 9642 times


EDIT (8/14/12): The older version of the rule had an error in it. Re-download if you downloaded it before.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Basic sync recipe Sun Jul 15, 2012 8:48 pm • by JohnBurridge
Thanks, Mr. Noodle. Things seem to be working well. I am concerned about performance, though (things got rough synching the initial 3,500 image files), so I will experiment with synching at a particular time of day, but as-is, your recipe is responsive and instantaneous, I just don't know how it will affect things in the day to day.

I'm a little confused about the condition "Date matched in not in the last 10 minutes"... how would that help not bog things down? Would this just mean that Hazel checks every ten minutes instead of constantly?

Thanks again.
JohnBurridge
 
Posts: 5
Joined: Thu Jul 12, 2012 3:10 pm

Re: Basic sync recipe Tue Jul 17, 2012 3:19 pm • by Mr_Noodle
No, it would not match if the file was checked in the last 10 minutes, thus making it so the action is run, at most, every 10 minutes. That said, the condition part, since it scours the whole file/folder tree, does take some time itself. If you can get away with doing it on a schedule instead, that's probably the most efficient.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Basic sync recipe Fri Apr 05, 2013 4:43 pm • by toddtmw
Mr_Noodle wrote:Here's a basic sync rule. It looks complicated but that's because it's very complete.

The first thing you should know is that if you want to sync a folder and all its contents, you need to have Hazel monitor the folder containing that folder you want to sync. Then you create a rule to match the folder you want to sync. In the rule I've attached, it matches against a folder named "blah". Change that to suit your situation.

The rule then matches if (a) the folder itself has changed or (b) any of its subfiles has changed. As a result, this will do a sync every time anything is modified. If it's a big folder tree, you may want to add a condition to do it less frequently, like "Date matched is not in the last 10 minutes", so that it doesn't bog things down. Alternatively, you can sync on a schedule using the Current Time attribute and get rid of all the conditions relating to date modified.

sync.hazelrules


EDIT (8/14/12): The older version of the rule had an error in it. Re-download if you downloaded it before.

I downloaded this recipe and imported it as a rule for a folder called Videos. Inside the Videos Folder, I have a Movies folder. I changed blah to Movies and then pointed the Sync into section to point to the Videos folder on my Drobo that has a Movies folder inside that has most of the content from the source.

The Drobo folder has most of the files, but there are 4 new files in the original location.

I used terminal to touch one of the files that has not been copied and I started Hazel. Looking at the log, I see that it is processing:

2013-04-05 14:18:39.113 hazelworker[96621] Processing folder Videos
2013-04-05 14:18:41.150 hazelworker[96621] Movies: Rule Sync folder "Movies" matched.

But it has been running for 2 and a half hours. I see other entries in the Hazel log, but I do not see an end message for Videos.

And nothing has copied from the source to the destination.

I guess I don't understand why Sync is so complicated to set up. Shouldn't you just be able to specify the source folder and the destination folder and the Sync keyword should just keep the two folders in, well, sync?

EDIT: I rebooted and let it run and it seems to be working now. Please disregard.
toddtmw
 
Posts: 1
Joined: Fri Apr 05, 2013 1:22 pm

Re: Basic sync recipe Sun Sep 08, 2013 12:10 pm • by Borbygoymos
Having trouble getting this one to fly. Followed the instructions as stated. Rules parent set is my OSX user account. Any ideas?

log error:

2013-09-08 12:08:25.597 hazelworker[1123] Could not resolve path for bookmark data: Error Domain=NSCocoaErrorDomain Code=259 "The file couldn’t be opened because it isn’t in the correct format."
Borbygoymos
 
Posts: 3
Joined: Sun Sep 08, 2013 12:05 pm

Re: Basic sync recipe Mon Sep 09, 2013 12:25 pm • by Mr_Noodle
Not sure if that error pertains to this. Go through the troubleshooting guide posted near the top of this forum and report back with the results of the preview and fuller logs.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Basic sync recipe Mon Sep 09, 2013 10:16 pm • by Borbygoymos
Read the troubleshooting post. I have corrected this by copying instead of syncing. Also posted on an "sync error: 23" post that brought my attention to the fact that apple metadata may prevent synching. My folder is the downloads folder, which you cannot edit the name or location. Probably caused the error...
Borbygoymos
 
Posts: 3
Joined: Sun Sep 08, 2013 12:05 pm

Re: Basic sync recipe Tue Oct 08, 2013 5:09 pm • by presda
I've been having difficulties getting this to work. Having downloaded the file from the site, I've added in the source folder and the destination folder as instructed. I've tried both the basic name of the source folder and the full extension (users/presda/etc...). Neither works.

The log comes out with this:


2013-10-08 22:07:30.620 hazelworker[726] Processing folder IB 1. Patterns in environmental quality and sustainability (forced)
2013-10-08 22:07:30.708 hazelworker[725] Done processing folder Rivers
2013-10-08 22:07:31.123 hazelworker[437] Warning: predicted fire time is in the past: 2013-10-06 23:00:00 +0000

The fire time thing is coming up all the time, but it means nothing to me. Is it even relevant?

Any suggestions? Thanks!
presda
 
Posts: 1
Joined: Tue Oct 08, 2013 5:03 pm

Re: Basic sync recipe Wed Oct 09, 2013 12:28 pm • by Mr_Noodle
First off, go through the troubleshooting guide above. Also, enable debug mode (also in a sticky article above).
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Basic sync recipe Mon Dec 02, 2013 1:05 am • by kripy
Is there any way to do a "smart synch" as in only update files that have changed? I'm trying to sync my working files as in files that I have modified into another folder that I'd like to synch with Dropbox. The sync rule works fine for any files in the root but when I modify a file in a sub-directory it syncs the entire directory (which is not ideal as I don't require all of those files).
kripy
 
Posts: 1
Joined: Sat Nov 30, 2013 5:11 pm

Re: Basic sync recipe Mon Dec 02, 2013 2:50 pm • by Mr_Noodle
Can you post/email logs showing this?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Basic sync recipe Mon Feb 03, 2014 3:41 pm • by Vlahn
Mr Noodle,

I'm trying to use the recipe you listed above, modified to point to my folders. My goal is to have any NEW or MODIFIED files that I place in a folder monitored by Hazel, be synced to a destination folder. However I don't want any new files that have been created in the destination to be overwritten when the sync occurs.

Currently, the behaviour I am witnessing is that a 'sync' will just do a copy of everything from the monitored folder to the destination folder, completely wiping any files that don't originate in the source, or new modifications than the files being copied.

Is this how a sync is meant to perform? I feel like I've had it working better than this in the past...

Edit: Meant to add also, I am using Mavericks. Only recently updated.
Vlahn
 
Posts: 7
Joined: Mon Sep 13, 2010 12:07 pm

Next

Return to Support