Complex nested folder multi-type file moving/trashing

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

Moderator: Mr_Noodle

Hi there- I have Hazel monitoring my Downloads folder for compressed files. When it detects a .zip, it decompresses it and then scans the resulting subfolders. When it finds a music file, it 1. checks via Applescript to see if Music is running and if so, 2. copies it to Music and then trashes the file. So far, so good.

This works great for zip files that JUST contain music. Where I run into trouble is: I have another script which then scans for empty folders and trashes them. Unfortunately, music downloads from Bandcamp.com almost always come with at least one image file for the album cover, which I don't need. These image files inevitably cause the "Delete empty folders" script to skip their parent folder. Is there some way I can add an action to my original music checking script that will add the music files to Music and then delete anything else in the folder that ISN'T a music file? I can't just have Hazel go through and delete every image out of the Downloads folder because sometimes I have legit image files in there. Is there a way to put in a sort of "If-Then-Else" logic where it could say "if this is a music file do X, else if it's an image do Y, and then trash the parent folder"?
sfritz313
 
Posts: 2
Joined: Tue Mar 06, 2007 12:47 pm

Is there a way to identify the unzipped folder or the image file in it? Usually, the cover image has a name like "cover.jpg".
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yes, the cover image almost always is "cover.jpg".
sfritz313
 
Posts: 2
Joined: Tue Mar 06, 2007 12:47 pm

In that case, you can have a rule match that specific file and throw it away.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support