In Windows, is there any software to prevent duplication of files in a folder?

0

Let's say I have two files c:\f1\data.txt and c:\f2\data.txt.

If I issue the command

copy c:\f2\data.txt c:\f1\data\

I will receive a warning about the potential overwriting. I will receive the same warning, as a dialog box, if I try to graphically drag data.txt from c:\f2\ and drop it in c:\f1. This behavior is due to the fact that the files have the same name (data.txt). I am happy with this behavior but I would like to extend it also to files with different names but with the same contents.

Let's say I have two files c:\f1\foo.txt and c:\f2\bar.txt and let's say foo.txt contains one line Hello World! and bar.txt contains one line Hello World!, so foo.txt and bar.txt have the same content, now the command

copy c:\f2\bar.txt c:\f1\

will succeed, but I would like it to fail.

I would be happy to have this behavior just for one folder, is there any software to achieve my goal?

Alessandro Jacopson

Posted 2014-10-24T14:31:58.640

Reputation: 255

Question was closed 2015-07-31T03:21:48.663

Answers

1

There are no programs that I can think of that do this.

You can easily write a script or application to do a compare before a copy and warn you if they are identical. However... there is always a caveat. How do you do the compare? Since you are dealing with text files, data might appear to be the same, however it isnt. Take the following examples:

This is a test.

and

This is a test. 

The lines look exactly the same. However, to a computer they are different. Take your mouse, left click and hold, and highlight the first example. Then highlight the second line. See the difference? There is a space after the period of the second example. These strings, while conveying the same information, are not identical. Even a difference of a single character, 1 byte, would allow the copy. If you are OK with that, then the application or script is super easy. I would recommend just getting the hash values of the two files and comparing that value. If the values are the same, warn and deny the copy.

Keltari

Posted 2014-10-24T14:31:58.640

Reputation: 57 019

0

UltraCompare can do what you want if you define some sync rules as you can see here.

Ryakna

Posted 2014-10-24T14:31:58.640

Reputation: 1 020

Does UltraCompare prevent me to make file duplication? It seems to me it just works later when I already had duplications... – Alessandro Jacopson – 2014-10-29T10:04:43.863