Сравнение папок на двух неподключенных компьютерах

1768
Abdull

Я хотел бы сравнить папки на двух разных компьютерах.

Я использую BitTorrent Sync для синхронизации 260 ГБ данных между двумя компьютерами: настольным ПК с Windows 7 и ноутбуком с Windows 8.1. Все эти данные находятся в иерархии каталогов с корневой папкой с именем «материал».

Я заметил, что существует значительная разница в размере и количестве файлов между тем, что сообщает настольный ПК, и тем, что сообщает ноутбук.

Теперь я хочу использовать инструмент, чтобы сравнить каталог «вещи» на настольном компьютере с каталогом «вещи» на ноутбуке, чтобы определить отсутствующие и измененные файлы и папки. Компьютеры не могут получить доступ к файловой системе друг друга через сеть, но передача результатов папки одного компьютера через USB-накопитель на другой компьютер вполне подходит.

4

2 ответа на вопрос

2
harrymc

Even if you cannot compare the files, a solution will be to compare their hashes.

One tool is the free and open-source md5deep :

md5deep is a set of programs to compute MD5, SHA-1, SHA-256, Tiger, or Whirlpool message digests on an arbitrary number of files

md5deep is able to recursive examine an entire directory tree. That is, compute the MD5 for every file in a directory and for every file in every subdirectory.

md5deep can accept a list of known hashes and compare them to a set of input files. The program can display either those input files that match the list of known hashes or those that do not match.

There are many other similar programs. A quick google found :

HashMyFiles
Gizmo Hasher
checksum

Or even see the long list in the wikipedia article Comparison of file verification software.

* md5deep * звучит многообещающе. Спасибо. Abdull 9 лет назад 0
2
Abdull

@harrymc's hint for using md5deep/hashdeep works well for me. The following provides a way to use hashdeep64 to compare a directory hierarchy between two computers:

# computer A == computer on which a hashlist.txt for all files in someFileHierarchysTopDirectoryOnComputerA is generated # computer B == computer on which computer A's generated hashlist.txt is used to compare files. Computer B generates a hashcompareresult.txt # On computer A, create a hashlist.txt for some file hierarchy located in directory someFileHierarchysTopDirectoryOnComputerA. hashlist.txt will be placed in someFileHierarchysTopDirectoryOnComputerA's parent directory. cd someFileHierarchysTopDirectoryOnComputerA hashdeep64 -c md5 -r -l -e -vvv * | tee ../hashlist.txt # this probably will take some time to finish. # Now copy the generated hashlist.txt onto computer B's "someFileHierarchysTopDirectoryOnComputerB/.." directory. Then on computer B, cd someFileHierarchysTopDirectoryOnComputerB hashdeep64 -c md5 -r -l -k ../hashlist.txt -a -e -vvv * | tee ../hashcompareresult.txt # hashdeep's -w, -W, -x, and -X modes don't seem to report errors on missing and additional files. Therefore using -a mode. # Above command will have generated a file hashcompareresult.txt in someFileHierarchysTopDirectoryOnComputerB's parent directory. # Now filter the created hashcompareresult.txt for mismatches: cat ../hashcompareresult.txt | grep -E ": No match|: Known file not used" # The resulting output shows files that # * exist only on computer A, or # * exist only on computer B, or # * exist on both computers at the same location but have different MD5 hashes. # Depending on the use case, above command probably will report some false positive files and directories, e.g. desktop.ini, Thumbs.db, .DS_Store, __MACOSX, .sync, and .SyncArchive . # It may be adequate to filter out these file system entries, e.g. with # cat ../hashcompareresult.txt | grep -E ": No match|: Known file not used" | grep -v -E "desktop.ini|Thumbs.db|.DS_Store|__MACOSX|.sync|.SyncArchive"