Please Help! Seems like a simple rule but not working???

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

Moderator: Mr_Noodle

Hello,

I am mucking about with Hazel to see if it is good for my needs but can't for the life of me work out how to get it to do what I consider to be a pretty simple task.

What I want Hazel to do is move a file contained in a folder up to its parent but I only want this to happen if the folder only has one file within it.

Al the moment I have tried:

If | all | of the following conditions are met
If | all | of the following conditions are met for | the current file or folder
sub-file/folder Count | is | 1
Kind | is not | Folder
Any File

Do the following..
Move | to folder | enclosing folder.

Any clue as to how I can do this?

Please note that I have tried placing the recommended include Nested Subfolders Rule beneath, in case that is needed:

If | any
kind | is | Folder
Run rules on folder contents

?????
bugmenot
 
Posts: 10
Joined: Tue May 29, 2007 11:52 pm

Note that the formatting in your post doesn't come through so I have to figure out how things are nested. Yes, you will need the subfolder rule to get to the file. In your nested condition, you want to use "enclosing folder" and not the "current file or folder". You want to check the sub-file count of the parent folder, not the file itself. Also, "any file" makes no sense here (it really only makes sense when used by itself).
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hello Mr. Noodle - Thanks for your quick response. I've written scripts before but there's something about Hazel's logic that just doesn't compute with me!

I've added an image of how I think the rule should work which should hopefully illustrate how I'm (incorrectly) tackling the problem.

Image

The Psuedocode would look like this:

If the current folder has exactly one file in it (which is not a folder itself), move this file out of its folder, up one level.

As it stands, the rule in the image above moves the entire folder (with the single file inside) to the enclosing folder.

I read your original reply and I think I'm just not thinking in Hazel's perspective as it didn't make much sense to me. :(

I hope this post helps illustrate where I am coming from at any rate.

And thanks again for your help!
bugmenot
 
Posts: 10
Joined: Tue May 29, 2007 11:52 pm

And just in case I somehow screwed it up, here's my Nested Folder Rule.

Image
bugmenot
 
Posts: 10
Joined: Tue May 29, 2007 11:52 pm

Do not use the "Run rules on folder contents" in the rule meant to match the file you want to move. It's in a separate rule for a reason. Also, as mentioned before, the sub-file count only makes sense when matched against a folder. In the pop-up that says "the current file or folder", change that to "the enclosing folder". That should do it.
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Do not use the "Run rules on folder contents" in the rule meant to match the file you want to move. It's in a separate rule for a reason. Also, as mentioned before, the sub-file count only makes sense when matched against a folder. In the pop-up that says "the current file or folder", change that to "the enclosing folder". That should do it.


Thanks Mr. Noodle. I got everything working but it has been a bit haphazard -- I checked the log and there was some crashes but after a reboot it's all working fine.
bugmenot
 
Posts: 10
Joined: Tue May 29, 2007 11:52 pm

Glad you got it working now. Can you email in the crashes? I'd be curious to see what they are.
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Glad you got it working now. Can you email in the crashes? I'd be curious to see what they are.


Sorry but the logs are gone. It was basically stuck in a loop as it had to work with a bunch of other rules. I just moved the rules around some and the loop stopped. Sorry I can;t be of more help. :/
bugmenot
 
Posts: 10
Joined: Tue May 29, 2007 11:52 pm


Return to Support