Rename Contents to Folder Name?

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

Moderator: Mr_Noodle

Rename Contents to Folder Name? 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!
kraymitchell
 
Posts: 4
Joined: Sun Sep 22, 2013 3:00 pm

Re: Rename Contents to Folder Name? 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.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename Contents to Folder Name? 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!
kraymitchell
 
Posts: 4
Joined: Sun Sep 22, 2013 3:00 pm


Return to Support