Hi Salmon Trout,
Yes you're right - I've got a SQL n COBOL background, and know very little about DOS batch scripting.
So apologies for making elementary mistakes.
Here's the script again, after a few suggested changes and incorporating some REM's:
@echo off
REM Check to see if the input folder is empty
cd d:\fromdoka\files\
dir %1|find " 0 File(s)" > NUL
if errorlevel 1 goto Extract
dir %1| find " 2 Dir(s)" > NUL
if errorlevel 1 goto Extract
echo No Booking Files Pending
goto end
:Extract
cd d:\fromdoka\scripts\
REM In the folder above, there may be none, 1, or more archive files in .tar.gz format
REM My intention is to extract the underlying text file, copy it to another folder, and
REM do some housekeeping.
REM All of this should be done automatically, in a Windows scheduled task.
REM On my Windows 2000 machine, I have installed 7-Zip to do the extracting, but the problem
REM is that 7-zip won't do it in one step, it needs 2 steps
REM First is extract .gz to .tar Second is extract text file from .tar
REM So the iteration should process one .gz file at a time
REM I cant find any other command line applic to do the extracting in one step on Win2k
REM ddir is the download directory for the transactions
REM tdir is the output directory where the GZ files will be extracted to TAR files
set tdir=D:\FromDoka\1_Tar_Files\
REM gdir is the output directory where the TAR files will be extracted to GLE text files
set gdir=D:\FromDoka\2_GLE_Files\
REM zdir is the directory where the executables are kept
set zdir=D:\FromDoka\Scripts\
REM Here is the loop for processing multiple booking files
for %%f in (%ddir%\*.gz) do (
%zdir%\7za.exe e %ddir%\%%f -o%tdir% -aoa
ECHO Waiting 3 seconds to ensure the first step is completed
PING 1.1.1.1 -n 1 -w 3000 >NUL
%zdir%\7za.exe e %tdir%\%%f -o%gdir% -aoa
)
:Housekeeping
move /y %ddir%\*.gz d:\fromdoka\3_gz_archives\
REM switch y overwrites existing files without prompting
REM copy /y d:\fromdoka\2_GLE_Files\*.gle "c:\Program Files\MeridianEBanking\FromDOKA\Staging_Files\"
move /y d:\fromdoka\2_GLE_Files\*.* d:\fromdoka\4_GLE_Archives\
del d:\fromdoka\1_Tar_Files\*.*
:end
When I run the batch file I get the same error as before - file not recognized as an internal command .....