我有一台运行 Windows Server 2003 R2 Enterprise 的服务器,每个目录包含 50,000 到 250,000 个 1KB 文本文件。文件名是连续的(例如,MLLP000001.rcv、MLLP000002.rcv 等),相同的文件将是连续的。一旦后续文件不同,我可以预期我不会收到另一个相同的文件。
我需要一个脚本来执行以下操作,但我不知道从哪里开始。
for each file in the target directory index 'i'
{
for each file in the target directory index 'j' = i+1
{
compare the hash values of files i and j
if the hashes are identical
delete file j
if the hashes differ
set i = j // to skip past the files that are now deleted
break
}
}
我尝试了 DOS 批处理脚本,但这真的很麻烦,我无法跳出内部循环,并且它会自行绊倒,因为外部循环在目录中有一个文件列表,但该列表不断变化。据我所知,VBScript 没有散列函数。