Compare Folder

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
boxy_25
Posts: 26
Joined: Tue Dec 02, 2003 3:49 am
Location: France
Contact:

Compare Folder

Post by boxy_25 »

Hi,

I use robocopy to mirror the content of my backup files (from backup exec) stored on HDD to a server NAS.
I'd like to be sure that copy works fine.
I'd like to test every day if the content of my 2 folders is the same.
Is there a solution in HM to do that? I cannot find a compare folder test.

thanks.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Actually, HostMonitor does not offer prepared solution regarding this case. Yes, it's possible to setup two "Folder File/Size" and/or "Count Files" test methods to check both folders and use "Advanced mode" action to compare the results. However, I do not think it's pretty reliable solution.

That's why I would suggest you to use "Shell Script" test method ( http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell ) and some third party compare tool, like "DiffUtils for Windows" ( http://gnuwin32.sourceforge.net/packages/diffutils.htm )

As an example, you may use following script in "Script Manager":
Start cmd: cmd /c %Script% %Params%
Script:

Code: Select all

"C:\diff\bin\diff.exe" --ignore-file-name-case -r --text --brief %1 %2 > C:\temp\compare_results.txt
type C:\temp\compare_results.txt | find " " >NUL
IF ERRORLEVEL 1 (
	echo ScriptRes:Ok:
) ELSE (
	echo ScriptRes:Bad:
)
Instead of "C:\diff\bin\diff.exe" you should specify full path to diff.exe utility (part of "DiffUtils for Windows" package) on the machine, where HostMonitor is running. So, to make script work, you just should setup a "Schell Script" test method using foregoing script and specify folders to compare into "Params" box in "Test Properties" window, e.g.: \\192.168.1.104\temp\test C:\Temp\test1

As you may see, intermediary file "C:\temp\compare_results.txt" is used by this script. You may adjust file name if necessary. Also, you may assign "Send mail" action to the test and attach this intermediary file to the mail in case compare fails.

If you like, you may use windiff.exe tool from Microsoft or any other similar tool instead of GNU diffutils. In this case, you just should slightly modify the script.

Regards,
Max
doodleman99
Posts: 38
Joined: Tue Sep 02, 2008 5:45 am

Problem

Post by doodleman99 »

Hi there,
i have done what you have suggested but having an odd problem...

i have created the shell script test as suggested and when i goto the "Lets Try" Tab where the script is created/edited. i get the following from the test when the folders are in sync:

[12:03:23] Agent: active-ERDC1.ERcm.internal is going to execute "Compare File/Folder Count" script ...
[12:03:24] Script started, invalid result received:
----------
C:\Program Files\HostMonitor7\RMA-Win>"C:\bat\diff\bin\diff.exe" --ignore-file-name-case -r --text --brief C:\Test1 C:\Test2 1>C:\temp\compare_results.txt

C:\Program Files\HostMonitor7\RMA-Win>type C:\temp\compare_results.txt | find " " 1>NUL

C:\Program Files\HostMonitor7\RMA-Win>IF ERRORLEVEL 1 (echo ScriptRes:Ok: ) ELSE (echo ScriptRes:Bad: )
ScriptRes:Ok:
----------

So there it says there "Script started, invalid result received" but at the end it still give the "OK" result.
if i set the two folders to be out of sync i get the following:

[12:06:41] Agent: active-ERDC1.ERcm.internal is going to execute "Compare File/Folder Count" script ...
[12:06:41] Script started, invalid result received:
----------
C:\Program Files\HostMonitor7\RMA-Win>"C:\bat\diff\bin\diff.exe" --ignore-file-name-case -r --text --brief C:\Test1 C:\Test2 1>C:\temp\compare_results.txt

C:\Program Files\HostMonitor7\RMA-Win>type C:\temp\compare_results.txt | find " " 1>NUL

C:\Program Files\HostMonitor7\RMA-Win>IF ERRORLEVEL 1 (echo ScriptRes:Ok: ) ELSE (echo ScriptRes:Bad: )
ScriptRes:Bad:
----------

Again i get that "Script started, invalid result received" at the beginning, but the test seems to be working as i get the "Bad" status?

this is the error i get from the actual test http://img39.imageshack.us/img39/5445/hosterror.jpg

i have tested using %1 %2 in the script and then entering the Parims and just adding the Folder location in the script and both give correct reply in the "Lets Try" tab but get the error when applied and running :(

i am using the latest version of Hostmon
both machines are Windows SBS2003
HostMon and Agent are in two locations so this is configured to run on Agent machine not Local Host(if that makes sense)

Many many thanks,

James
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Please insert "@echo off" as 1st line of the script

Regards
Alex
doodleman99
Posts: 38
Joined: Tue Sep 02, 2008 5:45 am

Post by doodleman99 »

Aaaargh.... Was going to try that :(
Will let you know, thanks for the reply.
---------------------------

Update:

yeah that worked a treat thanks.

Doh'

James
Post Reply