Hello,
i need a function to compare two folders for existence of files. Both folders must have the same number of files. The date/time are not interessting.
Thanks
dirk
Compare folders
I think you may create Java or VB script and start that script using Active Script or Shell Script test methods.
http://www.ks-soft.net/hostmon.eng/mfra ... htm#script
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
"FileSystemObject" provides access to file system. Use "GetFolder" method and "Files" property of "Folder" object
http://msdn.microsoft.com/library/defau ... erence.asp
Something like
Regards
Alex
http://www.ks-soft.net/hostmon.eng/mfra ... htm#script
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
"FileSystemObject" provides access to file system. Use "GetFolder" method and "Files" property of "Folder" object
http://msdn.microsoft.com/library/defau ... erence.asp
Something like
Code: Select all
const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"
Function CountFiles(foldername)
Dim fso, f1, fc, cnt
Set fso = CreateObject("Scripting.FileSystemObject")
Set fc = fso.GetFolder(foldername).Files
cnt = 0
For Each f1 in fc
'here you may check for some specifiec name of the file...
cnt = cnt + 1
Next
CountFiles=cnt
End Function
FUNCTION PerformTest()
IF CountFiles("c:\folder1\")<>CountFiles("c:\folder2\") THEN
PerformTest = statusBad
ELSE
PerformTest = statusOk
END IF
END FUNCTION
Alex