arcker Posted March 29, 2007 Posted March 29, 2007 This script lets you fast compare two directories it can be used to verify if a folder copy was really well done hope you'll like it #include<file.au3> msgbox(0,"",_comparefolder("c:\temp", "\\remotecomputer\c$\temp")) #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: Arcker Date: 03/29/2007 Script Function: This function fast compare two folders by using the dir and find command. Return Values : Return 0 if directories are identical Return 1 if directories contains some differences Notes : Be careful of the logsize #ce ---------------------------------------------------------------------------- Func _comparefolder($sourcedir, $targetdir,$arguments = " /s ",$directorytag = "<REP>") FileDelete(""""&@ScriptDir &"\*.log""") Runwait("cmd /c dir "&$arguments& " """ & $sourcedir & """ > """ & @ScriptDir & "\sourcedir.log""",@WorkingDir,@SW_HIDE) RunWait("cmd /c dir "&$arguments& " """ & $targetdir & """ > """ & @ScriptDir & "\targetdir.log""",@WorkingDir,@SW_HIDE) RunWait("cmd /c find /v """ & $sourcedir & """ < sourcedir.log > sourcedirn.log",@WorkingDir,@SW_HIDE) RunWait("cmd /c find /v """ & $targetdir & """ < targetdir.log > targetdirn.log",@WorkingDir,@SW_HIDE) ;we remove the directories to bypass directories data differences RunWait("cmd /c find /v """&$directorytag&""" < sourcedirn.log > sourcedirnew.log",@WorkingDir,@SW_HIDE) RunWait("cmd /c find /v """&$directorytag&""" < targetdirn.log > targetdirnew.log",@WorkingDir,@SW_HIDE) ;then we remove the header local $arrayfile _FileReadToArray("targetdirnew.log", $Arrayfile) _FileWriteFromArray("targetdirnew.log", $arrayfile, 3,UBound($arrayfile) - 3) _FileReadToArray("sourcedirnew.log", $Arrayfile) _FileWriteFromArray("sourcedirnew.log", $arrayfile, 3,UBound($arrayfile) - 3) return runwait("cmd /c fc """ & @ScriptDir & "\sourcedirnew.log"" """ & @ScriptDir & "\targetdirnew.log""",@WorkingDir,@SW_HIDE) EndFunc ;==>_comparefolder -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now