Creation of new folder, based on filename

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

Moderator: Mr_Noodle

Creation of new folder, based on filename Thu May 31, 2018 8:07 am • by NilsMorten
Helo Noodlesoft, and all users of this forum

I have a problem, and maybe you can help me out.

I have a set of videofiles, that has been transcoded using Adobe. CC MediaEncoder software on Mac
These files were transcoded using watchfolder logic inside MediaEncoder.
As a part of this process I used hazel to rename the file before transcoding, so that part of the filepath is part of the filename.
The "path" needs to travel with the file in some form or another, and cannot be stored as i.e. keywords in the file ... as MediaEncoder strips all information for the new transcoded file.

Now after the files have been transcoded, MediaEncoder manages to place the files very close to the desired target, but not all the way ... This is because the destination folder for the files may not hav been created yet.
The name of the folders are Dates, and the creation date of the file is now part of the filename (start of the filename)

i.e. 2018-05-02_2238083#469764.mxf. (mxf is a type of videofile)
2018-05-02_(the start of the filename) was added by Hazel before the file was sendt to transcoding.

What I want to happen is that these transcode files are sorted into subfolders, and the name of these subfolders are the Date specified in the start of the filename ....

So ... the file 2018-05-02_2238083#469764.mxf is placed in a folder named 2018-05-02, and the folder is created if the folder does not exist.
Then the file is renamed, by removing everything in front of and including the underscore ..

Can this be done ?

Kind regards Nils M Alexandersen
NilsMorten
 
Posts: 7
Joined: Wed May 30, 2018 7:53 am

Re: Creation of new folder, based on filename Thu May 31, 2018 11:23 am • by Mr_Noodle
Check out "match patterns" in the help. Using those, you can create a custom attribute which matches the first part and uses that in a "Sort into subfolder" action.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Great Tip. Thanks a lot. It worked like a charm

But now I am stuck .... again :D

All the files in these new DATE folders needs to be renamed
I want them all to loose the DATE prefix, including the following underscore character

I have tried and tried again, but nothing in the rename category ticks any buttons ....
I guess I have to separate the filename logically into two parts, and then use only the last part for your renaming logic, but how ?

I must be looking at this all wrong.

Can you supply me with some guidelines please ?

Kind regards Nils
NilsMorten
 
Posts: 7
Joined: Wed May 30, 2018 7:53 am

Re: Creation of new folder, based on filename Fri Jun 01, 2018 10:27 am • by Mr_Noodle
Yes, create a custom attribute to match the part after the prefix then use that in the Rename action. Basically, you want two custom attributes, one to match the first part (for the folder name) and another to match the rest (for the filename).
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support