Rename and replace

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

Moderator: Mr_Noodle

Rename and replace Tue Apr 19, 2022 5:43 pm • by PaulBII
Hello,

I'm using Hazel 5.1 in Mac OS 12.3.1.

I generate a PDF from a web app that creates a file in my ~/Downloads folder in the following name format, "Jane_and_John_(Full).pdf".

Then, I manually drag that PDF file to a monitored subfolder, ~/active/04-23-22 - Jane and John

When the file reaches that monitored subfolder, Hazel renames the PDF with the pattern <source folder><extension>, so it ends up as "04-23-22 - Jane and John.pdf"

I might go through this same process a few times. And I don't want to end up with -1, -2 versions, but cannot figure out how to replace a previously renamed pdf with a new version. And I don't see how I can pattern match in the If condition of a Hazel rule in the same way I can when I am renaming the file.

Any help or pointers?

Thanks!

Paul
PaulBII
 
Posts: 6
Joined: Thu May 24, 2007 5:33 pm

Re: Rename and replace Wed Apr 20, 2022 9:22 am • by Mr_Noodle
What is supposed to happen to the file if it is not supposed to be renamed?
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename and replace Wed Apr 20, 2022 2:40 pm • by PaulBII
Mr_Noodle wrote:What is supposed to happen to the file if it is not supposed to be renamed?


Thanks for the reply. I always want the downloaded PDF to be renamed. I just want it to overwrite any that might already exist with that same name.
PaulBII
 
Posts: 6
Joined: Thu May 24, 2007 5:33 pm

Re: Rename and replace Thu Apr 21, 2022 9:40 am • by Mr_Noodle
Is there a reason you move the file manually? Can you have Hazel do the move?
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename and replace Thu Apr 21, 2022 12:43 pm • by PaulBII
Mr_Noodle wrote:Is there a reason you move the file manually? Can you have Hazel do the move?


If that is possible, that'd be a fantastic solution.

This is an example of the folder structure where I the files end up:
Image

When downloaded the PDF is named: "Joyce_and_Heemin_(Full).pdf"

I'm not sure how to automate getting the files from Downloads into the appropriate destination folder.
PaulBII
 
Posts: 6
Joined: Thu May 24, 2007 5:33 pm

Re: Rename and replace Fri Apr 22, 2022 9:41 am • by Mr_Noodle
It's a bit tricky because the originals have an underscore. Do all of the names consist of the form "X and Y"?
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename and replace Mon Apr 25, 2022 12:41 pm • by PaulBII
Mr_Noodle wrote:It's a bit tricky because the originals have an underscore. Do all of the names consist of the form "X and Y"?


Maybe 90% of the time, they would be in that format. And those are the ones I am primarily concerned about anyway.
PaulBII
 
Posts: 6
Joined: Thu May 24, 2007 5:33 pm

Re: Rename and replace Wed Apr 27, 2022 9:01 am • by Mr_Noodle
You could have a pattern which matches those two names. Something like:
Code: Select all
    (anything)(• name 1)_and_(• name 2)(anything)


Then in your Sort into subfolder pattern re-combine them with the (anything) token for parts of the name outside of that.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename and replace Wed Aug 17, 2022 3:16 pm • by ryoustra
Piggybacking on the original question here - and note I've only just started using Hazel...

Is there a way to simply rename-and-replace? Rename does not appear to have an option to replace, and if I use Move (i.e., to another directory), its replace option fills up the Trash with filename-1, filename-2, filename-3 etc.

For background, I send a file of the same name to a directory every minute, and Hazel FTPs it to a server. I originally kept the same file in the directory - my program overwrote it every minute - but Hazel only uploaded the first time, perhaps not recognizing that the file is a different entity albeit with the same name. So I tried using Rename, but that generated the filename-1, filename-2 etc copies. So I then tried Move to another directory with the replace option, but that now fills up the trash with 1440 files a day.

Is there an easier way?? Seems overkill to now have to create a rule to manage my trash, hopefully there's a simpler approach.

TIA
ryoustra
 
Posts: 1
Joined: Wed Aug 17, 2022 1:21 pm

Re: Rename and replace Thu Aug 18, 2022 8:53 am • by Mr_Noodle
There is no option now but it is in the feature database for future consideration.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support