I need to test a very intermittent problem with our public/private network interface. Basically, I need to copy a file to both a UNC path and a mapped drive, verify that the files actually copied, report the status to HostMonitor, then delete the files. Any ideas on where to start with this or has anybody done something similar? I'm not much of a programmer (obviously) so I'm a little lost. Thanks!
- Craig
REQUEST: Script to copy file and verify
I hope you know how to use BAT files?
You may create simple script like this one
and use Shell Script test method to perform the test
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
Regards
Alex
You may create simple script like this one
Code: Select all
@echo off
copy c:\-tests\-\testfile c:\-tests\-\path1\ >nul
copy c:\-tests\-\testfile c:\-tests\-\path2\ >nul
if not exist c:\-tests\-\path1\testfile goto err
if not exist c:\-tests\-\path2\testfile goto err
echo scriptres:Ok:
goto final
:err
echo scriptres:Bad
:final
if exist c:\-tests\-\path1\testfile del c:\-tests\-\path1\testfile
if exist c:\-tests\-\path2\testfile del c:\-tests\-\path2\testfile
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
Regards
Alex
But then use:
With the verify (/v) you know that what is copied, is copied ok. Do realize however that when the first copy fails, the second wil not be performed. And when you have an unrealiable network connection, use robocopy from the resource kit instead of copy (it can perform multiple retries before giving up).
Code: Select all
@echo off
copy /v c:\-tests\-\testfile c:\-tests\-\path1\ >nul
if errorcode 1 goto err
copy /v c:\-tests\-\testfile c:\-tests\-\path2\ >nul
if errorcode 1 goto err
echo scriptres:Ok:
goto final
:err
echo scriptres:Bad
:final
if exist c:\-tests\-\path1\testfile del /q c:\-tests\-\path1\testfile
if exist c:\-tests\-\path2\testfile del /q c:\-tests\-\path2\testfile