Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
This is long but I'm trying to be detailed...
I need help with a script that will be run daily to copy files in numerous directories to a single folder on a backup server, then check to make sure the files were copied, then move on.
Right now I have checks in place to see if there are any files in the directories to copy, and after the copy & checks are completed it will go onto an archive section, which Leonardo Pignataro (Secret_Doom) was so kind to provide at:
http://www.computing.net/dos/wwwboard/forum/11558.htmlForutunately the file types are all the same (*.dss), and the directory structure is simple:
"C:\Download Tray\Folder ?\"
? is A B C D or EI have the script in place to go through the directories and copy any .dss files to t:\
Now I need a module that will look at the .dss files of each "C:\Download Tray\Folder ?\" and make sure that file exists on the t:\ mapping.
If everything is okay, then go on to the archive section; if one or more of the files did not make it, then go back to the copy process.(So I have the copy and archive section; I need the part to look in the directories and make sure that all the .dss files made it to t:\)
Thanks in advance!
Brian

Forgot to mention that the target (t:\) will have numerous other .dss files.
Here's what I have so far, and it seems to work, but I'm not very good at the really advanced scripting stuff, and I have no way to fake a "bad" copy.
Does it look like this will catch a file that was not copied and start the copy process over?
===== Begin script section =====
:upload
echo Uploading Files.....
for %%c in (A B C D E) do (
copy "C:\Download tray\Folder %%c\*.dss" %DIR1% /v )
goto verify:verify
for %%g in (A B C D E) do (
for /F %%f in ('dir/od/b "c:\Download Tray\Folder %%g\*.dss"') do (
if not exist %DIR1%\%%f (goto upload) else echo %%f copied!))
goto archive===== End batch section =====
I don't know if the formatting will post correctly, but does it look like I'm on the right track?
Thanks!
Brian

SpiderMSN,
My concern is that even with the /v switch, if for some reason the process fails (network connection down while copying, etc.), that the script may time or error out and continue on with the temporary archive, so the file would never be uploaded to the server for processing.
I just need checks in place to make sure everything makes it. I cannot assume that it does, I have to know for sure, and we don't have the resources to check manually (this will be run on about 100 machines, each one uploading about 5-6 files daily.
Thanks,
Brian

use the IF ERRORLEVEL statment to determine if the copy command returned an error code. And if that doesnt work this script should log each missing file to an error.log located in the directory you run your batch from
**********************************
: Verify
for %%s IN (*.dss) Do (
if NOT exist t:\%%s echo %%s was not copied to t:\ >> Error.log
)
type Error.log
echo Flanders is teh uber********************************
And yes the last line is VERY important. Be sure you keep it in your script, otherwise it could crash the internet or make your computer 'splode

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |