Target a specific subfolder

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

Moderator: Mr_Noodle

Target a specific subfolder Mon Aug 01, 2011 10:02 am • by fruityth1ng
Hi All!
(first off, yes, I have read the documentations on subfolders :)

Yet I still have trouble grasping the concepts, somehow I wish Hazel worked more like I'd think it does, instead of making me think like *it*.

My goals for the following rule is:
* Label all folders I have recently modified green (got this working)
* Remove the green label from all folders I have not recently modified (got this working)
* Label all folders I haven't touched in ages grey (got this working)
(this is the one I'm having trouble with)
* Rename all files in folders containing "Android" to lowercase, and replace the spaces with underscores.

+ the selected folder in the screenshot contains a bunch of png's, that I'm targeting.
+ way at the bottom you can see a folder that has been colored green by the first action
+ I'd like to *not touch* the other folders' contents
My trouble right now is that it *does* touch other folders not named Android.

Image

The "business end" rule is this:
Image

And the rules all together are:
http://www.nimbling.com/temp/2011.hazelrules

Thanks for reading this far,
any help and/or pointers are appreciated - including well directed RTFM's :)

-Though I'll be honest, I think hazel should include *n00b mode* or something, maybe start matching like apple mail rules, or automator like, looking at the 6K views of the subfolder topic in this forum ;)
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Mon Aug 01, 2011 2:17 pm • by Mr_Noodle
Right now, you can't do the search and replace for underscores. Version 3 will have this but in the current version doesn't (at least it can't do it for multiple ones within one file name).

Also, there's no good way for a rule to know what folder it is in. So, while you can have Hazel only go into specific folders, any rules set to operate on files won't have a way of knowing if it is operating on a file in that folder or some other folder. It's something I've thought about but haven't come up with a good paradigm for yet.

As for making subfolder stuff easier, I've thought a lot about this as well. It is a bit hard to understand but I've also found that making it too easy (like with a checkbox) will cause major problems for people who don't know what they are doing. I've had cases where people have really screwed up their files because they didn't understand how recursing into subfolders works. For the time being, I'd rather have a learning curve for this than to have naive users cause extensive damage. My experience has shown that what people expect in this case differs and is unpredictable from the POV of the software. Until I can come up with the proper magic, I'd rather have it be predictable even if it's a bit harder to learn.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Target a specific subfolder Mon Aug 01, 2011 4:39 pm • by fruityth1ng
I see I made the screenshot of the rule I used to reverse some renaming booboo's I made :)
-it should read "if foldername *does* contain Android, run the rest of the rules on the subfolders"
(it still doesn't do what I expect it to do though :( )

What steps do I need to make to do the labelling, *and* renaming files in subfolders named Android?

Maybe a rule named "Execute the following rules on the children of this folder" with an option "X levels deep" - and a visual way of seeing in which order the rules process (Maybe indenting actions under a "parent" like in programming - visually making them children of a certain condition.

You could check out Scratch, by MIT for an example of how it could look: (Multiplatform)
Image

- or Gamesalad (Mac)
Image

- or even Automator itself does a pretty good job of visually representing parent/child relationships.
Image

I don't mean to offend you, but I would just as happily buy hazel if it were implemented as special - super - easy automator actions :)
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Tue Aug 02, 2011 11:04 am • by Mr_Noodle
Thanks for the suggestions. I've thought about nested actions but there are still a few issues and such that would need to be worked out. It might work for your specific case but remember that people use Hazel in many different ways that don't necessarily match up with what you want in this particular instance. BTW, it's not clear to me how Automator demonstrates your point from that screenshot.

Also, you can already filter on folder depth. Look at subfolder level in the attributes.

One thing also I should've suggested before, why not have Hazel monitor the Android folder separately? If that's the only case where you need to go into the subfolder and treat those files differently, then if you add the Android folder to the folder list and give it it's own set of rules, I think that would do what you want.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Target a specific subfolder Tue Aug 02, 2011 11:41 am • by fruityth1ng
You're right, automator shows no hierarchy in this screenshot.

I don't think folder depth filtering is useful in this case. The Android folders can live at several depths.

What puzzles me, is if I set a folder to be ignored, do it's children still get checked for the rest of the rules?

Here's what I can't get hazel to do in a single folder watcher:
Do one thing to one set of folders,
Do another thing to another set.

I think what I'm missing is a way to specify what actions get to be applied on a folders contents, right now, as far as I understand, hazel applies *all* the rules for a watched folder on the subfolders below.

I want hazel to apply certain rules when it encounters a folder called "Android" - and certain other things on all other folders in the hierarchy.

Thanks for reading this far! - suggestions are very welcome :)
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Tue Aug 02, 2011 3:58 pm • by Mr_Noodle
It depends on how you use it. I should have pointed out in your rules that you are using it incorrectly. Having an ignore action in conjunction with any other action makes no sense. You clearly can't have Hazel ignore something if you already applied actions to it. The whole point is that you can set a rule to exclude certain files by making the ignore action the only action.

As I mentioned before, you can't do this all within one ruleset for a folder. If the logic is specific to a folder, you are better off adding that folder and giving it its own ruleset, if possible.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Target a specific subfolder Wed Aug 03, 2011 5:09 am • by fruityth1ng
Ah, thanks!
-no, there's a big mother folder, and I need several different things to happen in it, stemming from that single mother-root. Is that possible using Hazel?
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Wed Aug 03, 2011 1:45 pm • by Mr_Noodle
Unfortunately, the only way to do rules specific to a folder is to add it to the folder list and give it its own ruleset. Either that or write a script to handle it.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Target a specific subfolder Wed Aug 03, 2011 4:29 pm • by fruityth1ng
Thanks, I'll turn to applescript and a folder watcher for this case then. Still loving hazel for the more "regular housekeeping" ;)

The trouble you have coming up with something to satisfy both experienced and novice users both inspires and puzzles me. I wish I could help out!
I don't see what's wrong with ignoring a folder or file *after* applying actions to it - I'm clearly mistaken, but don't get why :)
The way I'm trying to reason it, is I want hazel to perform one set of actions on one bit, and another on another :)

I hope adding a "recurse into subfolders X levels deep" checkbox with a stern warning message is a feasible / responsible thing to do?
Maybe have the message link to a page explaining recursing into subfolders ;)

Right now, hazel has a single place/moment per folder for logic/conditions to be evaluated, I think allowing for additional- / sub-conditions might extend the flexibility of Hazel.

*** When I tell a rule to "run rules on folder contents" - does it execute "all the rules" or "just the rules below the one containing this command"? ***

In my example case, I wish I could make the following rule:
(Pseudo code alert ;) )

- Check folders for modification date, color accordingly (just the way as implemented right now)
- On folders I have recently modified (the folders I'm working on)
---\--- Traverse the folder hierarchy until I encounter a folder named "Android"
---------\--- rename all the files in this folder to a specific pattern

I'm sorry to be so resilient, I just feel Hazel should be the perfect match for doing this :)

thanks for all your time!
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Wed Aug 03, 2011 4:39 pm • by fruityth1ng
http://www.noodlesoft.com/forums/viewtopic.php?f=4&t=470 - answers my *** 'ed question: Hazel applies all rules to the files it encounters.
:)

(I'd still be grateful for any help with the rest of my post here!)
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Thu Aug 04, 2011 4:46 am • by fruityth1ng
I've got it!
I just had trouble wrapping my head around this :)

What I need is an option to "run *just these commands* on folder contents" - instead of "run *all* rules on folder contents" as is currently the case - and as you mentioned in earlier posts, being able to daisy chain other rules in this setup would make it super - powerful :)

I'll go post this under requests :)

**EDIT** ...this might be covered in the next release, looking at the beta screenshots :) Yay! :)
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Fri Aug 05, 2011 3:54 am • by justinkthornton
There are ways you can do this by separating files or folders into group through color labels, spotlight comments, or adding some text to filename. Then you can use those as conditions so hazel limit the rule those files.

Here is one example. Let's say you want the files in one set of of folders to to only have a subset of the rules applied to it.

Step one is to set up a rule to create an identifier on all the folders you want this subset to be.
You could do this by creating a rule that adds this to the file name to all files in the folder, hrfg1_ -- stands for "hazel rule folder group one" (or it could be done in comments field if you don't want it visible)

This let's you use the identifier as a condition to include, exclude or target that group of folders on the rules Set forth in the top level folder in the system. You can also create lots of groups via this method. You can even brush up on your ven diagram skills and apply multiple groups to the same folder so they overlap in certain folders.
justinkthornton
 
Posts: 26
Joined: Wed Aug 03, 2011 11:50 am

Re: Target a specific subfolder Fri Aug 05, 2011 7:19 am • by fruityth1ng
justinkthornton, thanks a bundle!
This is exactly what I want to achieve, but I still don't understand how to.

If I knew how to apply a label/comment/filename to all files in a certain folder, I'd already be there.

Right now, when I encounter a folder I'm interested in, all I can do to reach the files inside is "run rules on folder contents" which runs *all* ocnditions and rules again, or am I overlooking something?

Thanks again!
kind,
Herman
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Re: Target a specific subfolder Fri Aug 05, 2011 8:46 am • by justinkthornton
The rule to set an identifier like I explained above has to be done on that folder alone. Not to the parent folder. You should be looking at the left side of hazel not the right. It will say folders. Add the folder there. Then all you need to do is set the identifier rule.

So the rule would look like

If any file
Then set color label to red

Then apply the same rule in every folder you what to be part of this group. You can speed things up by dragging the pre made rule into the other folders after you have added the to hazel.

Back to the parent folder. You should have one rule that looks like this

If Kind is Folder
Then run rules on folder contents

Nothing else should be in this rule.

All other rules then would need to have the identifier we set earlier to include or exclude that group. So then I would put the condition, "if the color label is red" in every rule that I what that group to pertain to.

On the other hand if I want a rule not to use that group I would put, "if the color label is not red"

Get it.
justinkthornton
 
Posts: 26
Joined: Wed Aug 03, 2011 11:50 am

Re: Target a specific subfolder Fri Aug 05, 2011 9:12 am • by fruityth1ng
Thanks again!
Yes! I see :) - I'll have to go this route indeed.

I understand now, I was trying to automate adding specific folders to be treated this way as well.
Eagerly awaiting hazel 3 :)
fruityth1ng
 
Posts: 21
Joined: Mon Oct 12, 2009 7:26 am

Next

Return to Support