Here's my situation:
Computer A controls a medical device which daily generates a report file.
Computer A runs DOS 6.22 OS and is for safety reasons not connected to the network.
Server B runs Windows 2000 Server OS with a database where the data in the report files from computer A are to be inserted.
The general solution so far is to write a batch file which copies only files generated after previous batch file run, to a floppy disk.
The next step is to transfer and rename the log files from the floppy disk to a temp directory on server B. *I'll propably write this part in VB*.
The last step is to extract the data from the log files and insert them into tha database. *This part has already been created*.
I've tried to create a batch file (xferlogs.bat) based on Richard Bonner's CDUL.bat (http://www.chebucto.ns.ca/~ak621/DOS/Bat-Adv.html#CDUL) which copies all files create forward of given date.
I'd like to automate my batch file so that it retrieves the date on which the script was last run (e.g. from a file), increment it by 1 (i.e finds next day's date) and use this date as an parameter to the CDUL.bat.
My main problem seems to be passing the system variable containing the mentioned date to CDUL.bat. I get an "invalid parameter" error when my script executes the line "CALL CDUL.bat TheDate". If I type "CDUL.bat 09-06-02", the CDUL script executes correctly.
I've included the scripts below.
---
lastdate.txt contains only the date on which the script was last run in the format "mm-dd-yy"
---
Helper file sethelp$ contains only "set result="
---
:: xferlogs.bat (lacks code for finding the date after lastdate)
rem Read date of last action
@echo off
copy sethelp$ + lastdate.txt $tmp$.bat > nul
call $tmp$.bat
del $tmp$.bat
call cdul.bat result
rem update lastdate.txt with the current date
---
:: CDUL.bat
:: Copies Files on Today's, or from the Specified Date Forward,
:: to the Upload Directory
::
@ECHO OFF
Rem If no Date is Given, Today's Files will be Copied
IF "%1" == "" GOTO COPY-TODAY
Rem Otherwise, Files will be Copied Forward of the Date Typed
IF NOT "%1" == "" GOTO COPY-DATE
:COPY-TODAY
ECHO. | DATE | FIND /I "Current" > C:\BATCH\CUR-DATE.BAT
ECHO @SET CUR-DATE=%%4 > C:\BATCH\CURRENT.BAT
CALL C:\BATCH\CUR-DATE.BAT
Rem Copies Files based on Today's Date ("NUL" Hides Screen Messages)
XCOPY c:\batch\*.* C:\UPLOAD /D:%CUR-DATE% > NUL
GOTO END
Rem Copies Files based on The Date Given at the Command Line
:COPY-DATE
XCOPY c:\batch\*.* C:\UPLOAD /D:%1 /-Y
Rem Separates the Listing Gives a Listing for the UPLOAD Directory to
Show the Operation's Success
:END
ECHO.
REM CALL C:\BATCH\DR.BAT C:\UPLOAD
DIR c:\upload\*.*
Rem Removes the Date Variable From the Environment
SET CUR-DATE=
---
Does anyone have a suggestion as how to solve this problem, and hopefully update lastdate.txt with the current date? Alternative solutions are also welcomed.
Palsam