Delete Specific Files in a Folder

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

Moderator: Mr_Noodle

Delete Specific Files in a Folder Sat Aug 22, 2020 9:48 pm • by cohnhead
Hi. I am working with comic book files that I have setup a hazel rule to unzip. When I unzip, it creates a folder with the following format:

In each folder, there is a subfolder. In each subfolder, there are a lot of jpg files.

What I want to do is delete the first jpg file in this subfolder (the one that is sorted first alphabetically), and no more. I could even rename it so it doesn't sit first in the folder, but I cannot figure out a way to do this.

Does anyone have any ideas?
cohnhead
 
Posts: 2
Joined: Sat Mar 12, 2016 2:24 pm

Re: Delete Specific Files in a Folder Mon Aug 24, 2020 10:34 am • by Mr_Noodle
There's no good way using the built-in conditions. You'd probably need to write a script to determine the first one alphabetically. You can then use that as a Apple/Java/shell-script condition in your rule.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support