Move Duplicate Instead of Renaming or Deleting

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

Moderator: Mr_Noodle

I have a rule which monitors Folder1 for files and then renames them based on their contents and places the sorted files into Folder2. There will virtually always be an existing file with the same name in Folder2 as the renamed one being moved from Folder1. Of course, Hazel gives the option to rename, replace, or delete the existing file. What I would like to do instead is move the existing file into Folder3 (an archive folder). What is the best way to go about accomplishing this in Hazel?
Zyniker
 
Posts: 12
Joined: Fri Oct 18, 2013 5:42 pm

There might be a really roundabout way such as:

- Have Hazel rename the file when moving
- In folder 2, if a file exists that has the same name as the file but with a number after it, move the file to archive.
- In folder 2, if the file matches the pattern where it has a dash and number at the end (i.e. when Hazel renamed it), renamed it without the number.

To do the last couple steps, you need to hold down option while clicking the + button to create a new condition. That will create a nested condition. You'd need to do two levels of that, first targeting the enclosing folder, then targeting "any of its subfiles" on that.

Or you can write a script. :P
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi Mr_Noodle,

I need exactly this - but I don't get it how to set this up.
Can you please explain it maybe with a screenshot?

Would really appreciate your help!

Thanks,
Tom
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

Can you post the specifics of your case? I find many times people think they are doing the same thing when it's different enough that any solution I provide won't apply.
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Sure:

300 pages catalog - 3 versions. So a lot of PDFs.
Renaming, moving, sorting etc. works perfectly with hazel.

But surely there are a lot of changes till the final version of this catalog.
Instead of replacing the older files (ex Page005.pdf) I would like to keep those previous PDF Versions in a backup folder. In the backup folder I don't care if the versioning is -1 -2 ... but the current pdf should be "clean".

I hope you understand my needs :)
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

What do you mean by "clean" here?
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Without any versioning like -1 or _1
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

I think that would require a script. You basically want is to renumber the previous "clean" version whenever a new one is copied which is logic that is not available now.
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:There might be a really roundabout way such as:

- In folder 2, if a file exists that has the same name as the file but with a number after it, move the file to archive.


In your first answer you mentioned this method.
How can you set up a rule like this -if a file exists that has the same name-
This is where I got stuck - how can you pass through the file name to another rule?
I think this would help...
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

Note this will only work if both folders are "close" to each other (like in the same folder). Did you look up "nested conditions" in the manual?
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Sure, but as is said - I don't get it :)

I really think your mentioned method would fit my needs.
Could you quickly set up those rules an post a screenshot?
For dummys in this case....

Thanks a lot!
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

You'll need to post the exact folder structure as any solution is dependent on that.
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Catalog_2018
Folder --- Print_PDFs
EN_Page_01.pdf <---- a new Version of EN_Page_01.pdf
Subfolder --- Language01
EN_Page_01.pdf
EN_Page_02.pdf
......

Subfolder --- Language02
Subfolder --- Language03
Subfolder --- Archive

With a previous rule the generated PDFs are sorted into Print_PDFs.
(some steps with renaming, moving around for preflight...)
Next important Step woulb be:
- the new Version of EN_Page_01.pdf should go into Language01
- the Pdf which is already exists in this folder should go into archive

If this would be better, there could also be an archive folder in each language folder.
Doesn't matter.
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

Still not clear on a few key details. When the old "01" file is moved to archive, what is it named? Also, where are the "02", etc files coming from?
Mr_Noodle
Site Admin
 
Posts: 11226
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Numbers are the pages (Page_01, Page_02 ...).
The naming of the old files moved to archive basically doesn't matter.
Could be hazel standard like -1 -2 -3 - if possible V01 V02 V03.
Would be nice but not necessary
carver
 
Posts: 12
Joined: Thu Mar 08, 2018 8:44 am

Next

Return to Support