Working on matched folders & its contents.

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

Moderator: Mr_Noodle

As a new Hazel user, I'd like you guys' opinions on whether this workflow I have in mind is achievable with Hazel:

In "Downloads" folder
Look into the content of any folder whose name ends with "/png"
Delete any PNG files inside those matched folders (but ONLY PNG files).
Once done, rename that parent folders so that the names no longers end with "/png"

THe idea is that if I need to delete all PNG files inside a folder, I only need to put "/png" at the end of the folder's name, and Hazel will do the rest for me.

Any help would be appreciated.
Thanks
Last edited by nguyenhimself on Thu Aug 30, 2012 11:36 am, edited 1 time in total.
nguyenhimself
 
Posts: 5
Joined: Fri Jun 08, 2012 1:37 pm

Check out the sticky article about going into subfolders. You can add a condition to the rule given there like "Name ends with /png" so that it only goes into those folders.

To rename the folder afterwards, you can add a rule (before the one above) as follows:
Code: Select all
If all are met for the file being matched
    Name matches (•name) /png
    If all are met for all subfiles
        Extension is not png
Then
    Rename (•name)

where (•name) is defined as (...). This basically matches folders ending with /png but without any png files in it and renames it with the first part of the name before /png. I suggest reading up on "match patterns" in the help.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks a lot. That did the trick :)
nguyenhimself
 
Posts: 5
Joined: Fri Jun 08, 2012 1:37 pm


Return to Support