help w/ 2 things: copying modified files & coloring folders

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

Moderator: Mr_Noodle

So I've just been using Hazel for a few days now and I'm really loving it... (It took about 20 minutes of using the trial version before I purchased it!)

Anyhow, there are two things I'm not sure how to do:

1. COPYING MODIFIED FILES FROM NESTED FOLDER
I have a folder that contains a whole bunch of nested folders. Every time a file is modified anywhere within this subtree, I want that file to be copied to my Dropbox folder in the same relative location. The tip in this forum about running rules on subfolders was helpful. But I'm not clear on the best way to say WHEN A FILE CHANGES, COPY IT. I see there is a Date Last Modified attribute. Should I set that to in the past hour? Or will that cause it get copied many times during that one hour? ALSO: since I'm digging into nested folders, is there some method to copy a file to the same relative location in a different parent folder? This might be tricky enough that I'll have to write some scripts, huh?...

2. COLORING FOLDERS WITH CONTENT
Another scenario I have involves wanting to highlight a folder whenever there are files within that folder. I see there is a "number of items" attribute but that doesn't seem to do the trick. When I say "number of items is greater than 0", it sometimes thinks that this is true even when there is nothing in the folder. Is this related to hidden/system files? I've also toyed with saying when the size of the folder is greater than 0, but that also seems to not work as expected -- some folders have a size greater than 0 even when there are no visible files within it. Any advice?

(I'm new to Hazel *and* new to MacOS, so I might be missing some basic concepts about the mac file system...)

Thanks again for the amazing app.
yuvigroovy
 
Posts: 2
Joined: Mon May 17, 2010 9:48 am

The general solution for this situation is "Date last modified is after date last matched" which means if the file has been modified since the last time the rule was executed.

Note, though, that there is an issue with doing this with a subtree where you only want the changed files to be copied over. I don't want to type out this explanation again as it's long and subtle but, in short, you can't do it without having it make new copies of the files every time it is copied over. You can copy the root of the tree over each time but that would end up being way too resource intensive. This will be addressed in a future version but for now it's not doable without the above limitation unless you do a script.

As for number of items, it is possible that there are hidden files in there which, unfortunately, mucks things up. I'll have to think about this in future version. For now, I can't think of a good solution without scripting though.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the information. Two more follow-up questions if you don't mind.

1) Since there is a current issue with the LAST MATCHED condition within a subtree, then I may stick with my current rule, which says if it has been modified in the past 20 minutes. It seems to be working effectively. But just so I understand the potential flaws with my method... Is it possible that Hazel will not copy over the file if it doesn't check within 20 minutes? Or if I sleep the computer and then wake it up 20+ minutes later? How often does Hazel typically run a rule like this? I assume it is possible for Hazel to copy the same file over more than once, but this doesn't seem like a problem unless it tries to do it many many times (which doesn't seem to be the case).

2) Is there a way for Hazel to copy over the file into the same relative folder hierarchy (since I'm using that nested folder trick)? Or will I need to use a script for that... Any pointers for the general approach I should take to such a script?

thanks again for the great product...
yuvigroovy
 
Posts: 2
Joined: Mon May 17, 2010 9:48 am

Unless you are finding otherwise, the issue I referred to is not with the last matched. The issue is with #2. Yes, you can re-create the folder hierarchy by using the "source folder" attribute. You copy/move the file to the top of the tree and then do sort into subfolder using the source folder (look it up in the help). This is where the limitation comes in. The problem is that sort into subfolder will create a new file if the file already exists. There is no option currently to replace an existing file like there is with copy/move. This is what will be addressed in a future version.

If all you want to do is copy things over once, then it should be fine, but if you want to copy the same file over and over and have it replace the existing one, that is not doable without a script right now.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support