Entering and Exiting Subfolders

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

Moderator: Mr_Noodle

Entering and Exiting Subfolders Thu Oct 31, 2013 1:28 pm • by vertabatt
I am using Hazel to monitor a download folder. The goal is for Hazel to go into subfolder (depth 1) and move a file to its proper location, then return to the parent directory and delete that folder and any remaining contents. Then I would like it to go into another subfolder and do the same thing, etc, etc.

Typically files in the externalHD/ will look like this:

externalHD/

Homeland
-homeland.s03e04.mkv
-readme.txt
-homeland.txt

Itsalwayssunnyinphiledelphia
-its.always.sunny.s09e05.mkv
-sample.folder
-readme.txt

Keyandpeele
-Key.and.Peele.s03e04.mkv
-readme.txt

So, in the case of homeland I have three rules:

FIRST RULE:
IF
1) Kind is Folder
2) Name contains homeland

DO:
1) Run Rules on Contents

This gets Hazel into the homeland subfolder.

SECOND RULE:
IF
1) Name contains homeland
2) Size is greater than 50 MB

DO
1) Move to folder externalHD/media/TV/Homeland/Season 3
2) Run Applescript found here: viewtopic.php?p=1545#p1545

This should move the homeland episode, then the applescript should point Hazel back to the parent directory: externalHD/.

THIRD RULE:
IF
1) Kind is Folder
2) Name contains homeland

DO:
1) Move to folder Trash

This should move the folder where the episode was contained to the trash now that the episode has been extracted.

This is where the Hazel seems to fail. Hazel will move the homeland episode to the proper location, but the folder that contained it is never deleted. From there I want Hazel to complete these steps for several TV shows that automatically download to externalHD. So, I have three rules for each TV show. I think my problem occurs with the script, but I'm not sure. I can't seem to get Hazel to return to the right directory for rule 3.

Maybe there is an easier way than having three rules per show, but this is the best I could come up with on my own.

Help is appreciated!
vertabatt
 
Posts: 1
Joined: Thu Oct 31, 2013 1:19 pm

Re: Entering and Exiting Subfolders Thu Oct 31, 2013 3:55 pm • by Mr_Noodle
I've already answered this in email (please only do one or the other so I don't have to type answers twice - if in doubt, email support as I always answer that quicker). In short, that AppleScript only changes the target for that specific rule so you need to add the action to throw the folder away in the same rule after that AppleScript.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support