Rename folder question

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

Moderator: Mr_Noodle

Rename folder question Wed Jan 07, 2015 12:22 pm • by Robin2
Does anyone know of a way to configure rules so that Hazel will change the name of a folder to that of the first file contained within it?

For example, so that 'Untitled Folder' containing 'Holiday photo 1', 'Holiday photo 2', 'Holiday photo 3' and 'Holiday photo 4' will be renamed to 'Holiday photo 1'
Robin2
 
Posts: 2
Joined: Wed Jan 07, 2015 12:17 pm

Re: Rename folder question Wed Jan 07, 2015 1:33 pm • by Mr_Noodle
I'm not sure how you would determine first file since it's more of a visual thing than any intrinsic notion. If you know that the file you want always has a "1" at the end, you can try something like:
Code: Select all
If (all) are met
    Kind is Folder
    If (all) are met for (any of its sub-files)
        Name matches (•first filename)
Do
    Rename (•first filename)

where (•first filename) is a custom attribute matching something like: (anything) 1
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename folder question Thu Jan 08, 2015 6:05 pm • by Robin2
Thanks for the speedy reply.

I can't work out how you enter the third and fourth lines of the instructions into Hazel as the first rule has a second instruction in the splash screen that is needed to be filled in before you can proceed.

That aside...

There is one intrinsic value I can give the file name I want. I can say: rename the folder containing the files with the name of the first (or last) file created by date.

This would then result in the folder being renamed 'Holiday photo 1' or 'Holiday photo 2' (or 3 or 4 or 27 etc etc)

I can then lop off all the text after 'Holiday photo' with a batch filer renaming programme.

Thanks, anyway
Robin2
 
Posts: 2
Joined: Wed Jan 07, 2015 12:17 pm

Re: Rename folder question Fri Jan 09, 2015 12:39 pm • by Mr_Noodle
Forgot to mention that part. Hold down option while clicking the + button to create a new condition.

As for getting the the earliest file by date, you can try doing "Date created is among the 1 least recent" which gets the earliest file. Make sure to keep the Name matching condition there as you need to store the name of the file into that custom attribute.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support