View previous topic :: View next topic |
Author |
Message |
cterrell9
Joined: 09 Dec 2004 Posts: 2 Location: Texas
|
Posted: Thu Dec 09, 2004 2:14 pm Post subject: REQUEST: Script to copy file and verify |
|
|
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 |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12799 Location: USA
|
Posted: Thu Dec 09, 2004 5:07 pm Post subject: |
|
|
I hope you know how to use BAT files?
You may create simple script like this one Code: | @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
|
and use Shell Script test method to perform the test
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#chkShell
Regards
Alex |
|
Back to top |
|
|
Marcus
Joined: 18 Nov 2002 Posts: 367
|
Posted: Fri Dec 10, 2004 8:58 am Post subject: |
|
|
But then use:
Code: | @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
|
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). |
|
Back to top |
|
|
|