Renaming a file or folder based on its own name

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

Moderator: Mr_Noodle

So hello, here's my first post... I'm using Hazel for a few days now, and find it quite useful.
Here's something I'm trying to achieve :

I have a file lets say

Movie.2019.MULTi.1080p.HDLight.x264.AC3-TeAM_www.website.com.mkv

My idea, is to download the file in a folder and then create a new subfolder named
Movie.2019.MULTi.1080p.HDLight.x264.AC3-TeAM
And rename the video as
Movie.2019.mkv

As of now, I created a rule which deletes the _www.website.com and replaces it with nothing to create a subfolder, and the second rule renames the file, which is the easy part.

My question is :
what if the _www.website.com becomes_www.website.net or anything else? This won't work as it should, rules won't match. So I was thinking about a rule that says "anything after TeAM" gets deleted. Is it possible?
Anyone can help?

Thank you very much!
li0nel
 
Posts: 3
Joined: Wed Sep 04, 2019 3:28 am

I can't say what the pattern is based on that one file but if "TeAM" is always there then that would be one way to do it.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I can't say what the pattern is based on that one file but if "TeAM" is always there then that would be one way to do it.


Thank you!
For now I'm just replacing the _www.website.com with empty content, but yes, TeAM would always be there, so how can I tell Hazel "hey, delete whatever is after TeAM and use the rest as a folder name" ?

Here's my current rule https://jmp.sh/cTiasxl
li0nel
 
Posts: 3
Joined: Wed Sep 04, 2019 3:28 am

Try using a pattern with a custom attribute (search the help on "match patterns" if you don't know what that is) which matches everything up to the _TEAM part. Then in the rename or sort into subfolder action, you can use that attribute.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron