Delete Folder and Contents after UnRar

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

Moderator: Mr_Noodle

Delete Folder and Contents after UnRar Tue Oct 14, 2014 5:53 pm • by nids3rz
Hi everyone,

Been a while since I used Hazel. Had it set up previously, not all rules are working in my new set up.

I have Hazel watching subfolders and when extension matchers rar it unarchives (I used to have this manually set to open with Stuffit Expander). However, Unarchiving does that as well and deletes the rFiles.

My question now is - how do I delete the folder and all the other contents that are left over. My avi/mkv etc is unarchived automatically to another folder for processing so the leftovers are trash.

Any idea how to do this?

Sorry if I am unclear. Let me know if you need more information/need me to explain.

Thank you.
nids3rz
 
Posts: 10
Joined: Wed Nov 03, 2010 5:41 am

Re: Delete Folder and Contents after UnRar Wed Oct 15, 2014 11:27 am • by Mr_Noodle
You can add an extra rule to try and detect when the folder is no longer needed. Hold down the option key and click on the + button to create a new condition. That will create a nested condition. There you will see an extra pop-up for the condition's target. One way to do this is to set it to "all of its sub-files" and use a condition like "Kind is not movie" or somesuch. That will remove folders that do not contain a movie. Be careful, though, if you are going into subfolders. You might have to add a condition with "Subfolder depth".
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Delete Folder and Contents after UnRar Wed Oct 15, 2014 3:08 pm • by nids3rz
Thanks!
Love the software by the way.

I figured out another way. Incase anyone wants to know (for TV shows with rar files and want to delete the folder after unarchiving0

Watching folder: Complete

Rule name: Delete Folder
- If all:
... kind is folder
... date last modified is not in the last 1 hour
- Do the following:
... move to folder trash

Rule name: Look Subfolders
- If all:
... kind is a folder
- Do the following:
... Run rules on folder contents

Rule name: Unrar
- If all:
... extension is rar
- Do the following:
... Unarchive

So first it checks the folder for idle folders - deletes
Then checks subfolders for .rar files and unarchives.
Now those subfolders are idle it deletes them.

Hope it makes sense as it seems to work :)
nids3rz
 
Posts: 10
Joined: Wed Nov 03, 2010 5:41 am


Return to Support