Solved Compare files on two separate drives

Microsoft Windows server 2008 r2 enterpr...
September 28, 2015 at 02:41:34
Specs: All, ANY
Good Morning All;

I am looking for a way to compare two separate hard disk drives; and delete files that aren’t on both drives using a batch file; so far I can’t seem to find a solution to this problem.
Your help is greatly appreciated.

Tor Fey

See More: Compare files on two separate drives

Report •

September 28, 2015 at 19:39:32
✔ Best Answer
First, what constitutes "same filename". Does that include path? Or just that filename in any path location?
Second, are filenames trust-able? (ie: is the filename alone, and not the content, enough to make a match). If you need to compare file's contents, then you need to run fsum on all files on both drives (or do a binary compare of each file, which I believe would take a while.)

I would assume you intend "filenames trust-able" and path "not an issue". If that were the case, it's maybe not too hard. First, build a text-list of all filenames on both drives, then maybe use FINDSTR /G
using list#1 against list#2, deleting any "fails" from the #1 drive, then regenerate the #1 disk list and work it the other way (using list #2 against the refreshed list #1). That would be my initial strategy. No use wasting time with code until we see which shoe hits the floor first.

Report •
Related Solutions

Ask Question