По моему это уже не важно.
Но, скорей всего, я выделил это еще раз для Malcev'а.
Вот так выдает список файлов не имеющих совпадений по размеру, а также поиск в 2-х разных папках:
#SingleInstance,Force
SetBatchLines,-1
FileSelectFolder, path
FileSelectFolder, path2
;path=g:\
;path=%A_desktop%\test
SkipLargeFiles=1 ;пропускать файлы больше чем
Fsize=1 ; мегабайт
savefile=%A_desktop%\files.txt
count=-1
file := FileOpen(savefile, "w")
if !IsObject(file)
{
MsgBox Can't open "%FileName%" for writing.
exitapp
}
; Создаем 2-а массива и счетчик
loop,%path%\*.*,0,1
{
if stop=1
break
if (dir!=A_LoopFileDir)
{
tooltip,Сканирование файлов в папке %A_LoopFileDir%`nПросканированно %a_index% файла(ов).`nF1 - чтобы выйти.`nF2 - прервать и начать сравнение.
dir:=A_LoopFileDir
}
counts++
if (SkipLargeFiles=1 and A_LoopFileSizeMB>Fsize)
continue
listname%a_index%:=A_LoopFileFullPath
name%a_index%:=A_LoopFileFullPath
if A_LoopFileSize=0
name%a_index%.="`n size=0"
size%a_index%:=A_LoopFileSize
; MD%a_index%:=FileMD5(A_LoopFileFullPath)
}
loop,%path2%\*.*,0,1
{
if stop=1
break
if (dir!=A_LoopFileDir)
{
tooltip,Сканирование файлов в папке %A_LoopFileDir%`nПросканированно %counts% файла(ов).`nF1 - чтобы выйти.`nF2 - прервать и начать сравнение.
dir:=A_LoopFileDir
}
if (SkipLargeFiles=1 and A_LoopFileSizeMB>Fsize)
continue
listname%counts%:=A_LoopFileFullPath
name%counts%:=A_LoopFileFullPath
if A_LoopFileSize=0
name%counts%.="`n size=0"
size%counts%:=A_LoopFileSize
; MD%counts%:=FileMD5(A_LoopFileFullPath)
counts++
}
;msgbox,Найдено объектов: %counts%
; Определение совпадений
loop,% counts
{
count++
name:=name%a_index%
; if name%count% contains %exept%
; continue
if name%count%=
continue
tim++
if tim>5
{
name:=name%a_index%
tooltip,Сравнение файлов:`n%name%`n%a_index%\%counts%`nF1 - чтобы выйти.
tim=
}
loop,% counts
{
if (count=a_index or size%a_index%="")
continue
; if name%count% contains %exept%
; continue
if (size%a_index%=size%count%)
{
listname%count%=
listname%a_index%=
; list.= name%count% "---------------" name%a_index% "`n"
if s=
string:= name%count% "`n" name%a_index% "`n"
else
string:= name%a_index% "`n"
; file.Write(string)
; exept.= name%a_index% ","
size%a_index%=
s++
}
}
if s>0
{
string:= "`n"
file.Write(string)
s=
}
}
loop,% counts
{
if listname%a_index%!=
{
string:=listname%a_index% "`n"
file.Write(string)
}
}
tooltip
;msgbox,%list%
msgbox,Готово!
exitapp
f2::
stop=1
return
f1::
file.Close()
exitapp
FileMD5(sFile="", cSz=4) { ; by SKAN www.autohotkey.com/community/viewtopic.php?t=64211
cSz := (cSz<0||cSz>8) ? 2**22 : 2**(18+cSz), VarSetCapacity( Buffer,cSz,0 )
hFil := DllCall( "CreateFile", Str,sFile,UInt,0x80000000, Int,3,Int,0,Int,3,Int,0,Int,0 )
IfLess,hFil,1, Return,hFil
hMod := DllCall( "LoadLibrary", Str,"advapi32.dll" )
DllCall( "GetFileSizeEx", UInt,hFil, UInt,&Buffer ), fSz := NumGet( Buffer,0,"Int64" )
VarSetCapacity( MD5_CTX,104,0 ), DllCall( "advapi32\MD5Init", UInt,&MD5_CTX )
Loop % ( fSz//cSz + !!Mod( fSz,cSz ) )
DllCall( "ReadFile", UInt,hFil, UInt,&Buffer, UInt,cSz, UIntP,bytesRead, UInt,0 )
, DllCall( "advapi32\MD5Update", UInt,&MD5_CTX, UInt,&Buffer, UInt,bytesRead )
DllCall( "advapi32\MD5Final", UInt,&MD5_CTX )
DllCall( "CloseHandle", UInt,hFil )
Loop % StrLen( Hex:="123456789ABCDEF0" )
N := NumGet( MD5_CTX,87+A_Index,"Char"), MD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1)
Return MD5, DllCall( "FreeLibrary", UInt,hMod )
}
Для MD5, думаю, нет смысла искать не совпавшие файлы.
Осталось только облагородить внешний вид кода и убрать лишнее, но это вы уж сами, а то что-то я устал.