Page 1 of 1

script to compare duplicated files ?

Posted: 15 Oct 2017 10:24
by xnmp
is it possible to do a xyplorer script to compare duplicated files ,one by one,like this
compare "e:\folderA\folder1\somefiles.png" "e:\folderB\folder1\somefiles.png"

thank you


the reason i want to ask this because i want to compare duplicate files in similar/corresponding sub directory
like this
i have two folder "e:\folderA" (pool1) and "e:\folderB" (pool2)
i want to compare only files in similar folder structure ,for example
such as
e:\folderA\folder1\somefiles.png
with
e:\folderB\folder1\somefiles.png
you can see these files in two pool has the same directory structure which is
poolfolder\folder1\somefiles.png

Re: script to compare duplicated files ?

Posted: 15 Oct 2017 10:52
by highend
Compare by what, checksum, file size, cma dates?
What output should that script create, only files that don't match?
Compare all files, or only those with a specific extension?


You know that you can do that via the XY gui?
Switch to dual pane
Left pane: pool folder 1
Right pane: pool folder 2

Add the branch view button to the toolbar
Right click it, switch to "Files only"
Do that for both panes

Menu - Panes - Sync select...
Select Different
[x] On both panes

Re: script to compare duplicated files ?

Posted: 15 Oct 2017 12:26
by xnmp
highend wrote:Compare by what, checksum, file size, cma dates?
What output should that script create, only files that don't match?
Compare all files, or only those with a specific extension?
hello ,
Thank you for the help, i want to compare if the two files are exactly (or 99.999% chance) the same
i found your answer about script to checksum file viewtopic.php?f=3&t=16949
and my current method is to check if two files has the same file-size before compare their checksums, i know how to write a script to do that
please take a look and tell me if there is a better method

Code: Select all

using filesize() to check if two files have the same file-size
if (filesize(filea) == filesize(fileb))
{
//generate checksum 256-bit SHA-256 and compare
}
i 'm not sure if sync selected would check the checksum of file, it seems not ,so i think it's better to write a script to do that
Thanks alot

Re: script to compare duplicated files ?

Posted: 15 Oct 2017 12:49
by highend
Ofc you can check first if both files have the same size before you
calculate the hash and test that as well.

It will save quite some time if most of your files are identical
i 'm not sure if sync selected would check the checksum of file
Look into the help file ;)
Select Different: Select all matches with a different size or modified date.

Re: script to compare duplicated files ?

Posted: 15 Oct 2017 20:39
by xnmp
i see ,thank you very much for the help :mrgreen:

Re: script to compare duplicated files ?

Posted: 15 Oct 2017 20:42
by highend
And your final script looks like?