Page 1 of 1

Rename Contents to Folder Name?

PostPosted: Mon Jul 28, 2014 7:49 pm
by kraymitchell
I have a bunch of .jpg files with randomly generated names, each contained within a folder with the correct name the file should have.

Is it possible to have Hazel rename all .jpg files to the containing folder name, then move that file one folder up so I have all the files in one folder together instead of hundreds?

Thanks in advance!

Re: Rename Contents to Folder Name?

PostPosted: Tue Jul 29, 2014 4:00 pm
by Mr_Noodle
Please do not post questions in the Tips forum. The sticky article up top says not to do this.

As for your question, you can try something like:
Code: Select all
    If (all) are met
        If (all) are met for (the enclosing folder)
            Name matches (• parent folder name)
        Kind is JPEG
    Rename (• parent folder name)(extension)
    Move to (enclosing folder)


Some notes:
(• parent folder name) is a custom token set to match anything. Read the help on "match patterns".

To get the nested condition, hold down option while clicking the + button to create a new condition

You'll probably also need another rule to remove the empty folders, which I'll leave as an exercise for the reader.

Re: Rename Contents to Folder Name?

PostPosted: Tue Jul 29, 2014 5:59 pm
by kraymitchell
My apologies, as it was entitled Tricks/Recipe Exchange, I thought this was the right place. I admittedly did not review the sticky topic.

I will give this a try and see if I can get it working, thanks!