KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Compare Folder

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
boxy_25



Joined: 02 Dec 2003
Posts: 26
Location: France

PostPosted: Mon Jan 05, 2009 4:50 am    Post subject: Compare Folder Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Jan 05, 2009 8:05 am    Post subject: Reply with quote

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/mframe.htm#tests.htm#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:
"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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
doodleman99



Joined: 02 Sep 2008
Posts: 38

PostPosted: Mon Aug 17, 2009 5:22 am    Post subject: Problem Reply with quote

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
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Mon Aug 17, 2009 11:41 am    Post subject: Reply with quote

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

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
doodleman99



Joined: 02 Sep 2008
Posts: 38

PostPosted: Mon Aug 17, 2009 11:56 am    Post subject: Reply with quote

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

Update:

yeah that worked a treat thanks.

Doh'

James
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index