script to compare duplicated files ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

script to compare duplicated files ?

Post 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

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: script to compare duplicated files ?

Post 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
One of my scripts helped you out? Please donate via Paypal

xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

Re: script to compare duplicated files ?

Post 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

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: script to compare duplicated files ?

Post 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.
One of my scripts helped you out? Please donate via Paypal

xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

Re: script to compare duplicated files ?

Post by xnmp »

i see ,thank you very much for the help :mrgreen:

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: script to compare duplicated files ?

Post by highend »

And your final script looks like?
One of my scripts helped you out? Please donate via Paypal

Post Reply