Page 1 of 1

Working on matched folders & its contents.

PostPosted: Thu Aug 30, 2012 9:09 am
by nguyenhimself
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

Re: Working on matched folders & its contents.

PostPosted: Thu Aug 30, 2012 10:54 am
by Mr_Noodle
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.

Re: Working on matched folders & its contents.

PostPosted: Thu Aug 30, 2012 11:36 am
by nguyenhimself
Thanks a lot. That did the trick :)