Move file if extracted from archive, copy if not

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

Moderator: Mr_Noodle

Hello,

I have rules that work perfectly, except that I can't get Hazel to "remember" whether a file originated from a RAR/ZIP archive or not.

Here is the current order of rules, simplified:
* On folders, run rules on folder contents
* Ignore files labeled Green
* If archive, open in default application, label Green
* If a list of other criteria is matched, move to folder, label Green

So if it detects an archive, it's opened in the default app for extracting that archive type, and then labeled. Then Hazel detects the extracted file and runs the rules again, and moves it to the target folder.

If the file is not an archive, it of course skips that step and moves it immediately.

This works great in its simplicity, however there is one thing I can't figure out to do:

If not originating from an archive, I want the file to be copied to the target dir, and not moved. My first idea was to "set label on parent folder" or similar, but there doesn't seem to be any action in Hazel that can do this. Another option would be "does current folder contain files that match this pattern", in order to detect RAR/ZIP files in the same folder.

Any suggestions?
apstefan
 
Posts: 1
Joined: Mon Aug 19, 2013 5:19 am

You can do the last one by doing a nested condition. Hold down option and click on the + button to create a new condition. There, you can set the target of the condition to match sub-files.

Also, is there a reason why you aren't using Hazel's "Unarchive" action? If you do that, the subsequent label action will apply it to the unarchived folder, and not the original archive. You can use that to distinguish unarchived folders instead.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support