How to avoid copying a file if a duplicate exists?

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

Moderator: Mr_Noodle

I am looking at the options available when copying or moving a file,

If file exists:
    ( ) rename the file
    ( ) replace the existing file
    ( ) throw the file away
[ ] Throw away if duplicate


I understand that "If file exists" means simply looking at the file name, whereas "If duplicate" means that both file name and contents are identical.

However, what about files which are exact duplicates but with different file names?

For example, suppose my source has a file named "info.pdf", but in my destination I already have a file called "info-1.pdf whose contents are identical to "info.pdf". How can I avoid ending up with both files in the destination?
Trickyt57
 
Posts: 56
Joined: Tue Sep 18, 2018 12:17 am

Those don't apply here. Note that if you go to "File->Folder Options", you can have Hazel handle those types of duplicates for the folders being monitored.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Those don't apply here. Note that if you go to "File->Folder Options", you can have Hazel handle those types of duplicates for the folders being monitored.


That's useful.....to some extent.
However I have been trying to understand the definition of "duplicate" because in countless cases duplicate files were not thrown away despite checking the box "Throw away: Duplicate files"

After hours of experimenting, it looks like this duplicate rule only works for similarly named files with identical content. More precisely, it looks like Hazel automatically removes duplicate files from the source folder if they are identical to the original and have an identical name but with "Copy" or " "- 1 " after the name

So to illustrate:
If the destination folder contains a file called "birds. pdf":
And the source folder contains identical 4 files called "birds copy.pdf", "birds black.pdf", "gardenbirds.pdf* and "gardenbirds copy.pdf"

Then the following would happen when Hazel tries to move these four files from the source folder to the destination folder:
"Birds copy.pdf" would be deleted because it has the same name as the destination file and the word copy at the end,
"Birds black.pdf would be moved because it does not end in "copy".
"gardenbirds.pdf* would be moved because it does not end in "copy".
and "gardenbirds copy.pdf" would be moved because it does not have the same start name.

Have I understood the functioning correctly?
Trickyt57
 
Posts: 56
Joined: Tue Sep 18, 2018 12:17 am

You are correct in that the files have to follow a naming scheme. There is support for naming schemes of common programs like Finder and various browsers.

Keep in mind that that option applies to folders Hazel monitors directly and not the destination folders of rules, unless those folders are also monitored by Hazel.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support