1.

Solve : Error Check?

Answer»

Hi Guys,

I am new to DOS Programming. I have a small querry and would really appreciate if you guys can help.

Overview: I want to create a script that has to find a file in a location.

Problem: Both the name of the file and the folder in which the file is created is Variable.

I have written script for 1 file.

****************************************************************************
Del P:\LDN-Results.txt
:SET_DATE
Set /p COB=Enter LDN COB:
IF %COB% ==' ' GOTO END
Else GOTO Check_LDN_Jobs
:Check_LDN_Jobs
Set CBROL_LDN_FEED_TMP=
echo. > P:\LDN-Results.txt

If exist \\xyz\BatchData\temp\20070705_RE_CBROL_LDN_JET_OTH\JetBase_LDN_Others_ErrorLog.txt echo RE_CBROL_LDN_JET_OTH having errors! > P:\LDN-Results.txt

Notepad P:\LDN-Results.txt

:END

@ECHO ========== Batch File Finished ============
PAUSE
****************************************************************************

This is RUNNING successfully for this 1 file. but i want to do the smae for all the folders in "\\xyz\BatchData\temp\" starting with a given date. And then the files ending with "ErrorLog"

Please Assist.you don't want much, do you?
Hi .. I hope you got my question. Please Assist. I'am not really cleared about your problem
but, I try to SOLVED and Hope this help :

..UNTESTED..
Code: [Select]@echo off
Del P:\LDN-Results.txt
:SET_DATE
Set /p COB=Enter LDN COB:
IF "%COB%"=="" GOTO END
:Check_LDN_Jobs
Set CLFTMP=\\xyz\BatchData\temp
for /f "tokens=*" %%a in ('Dir /b A:D "%CLFTMP%"') do (
set SPATH=%%~a
CALL set sdate=%%spath:~0,8%%
If exist "%CLFTMP%\%%~a\JetBase_LDN_Others_ErrorLog.txt" (
echo Time : %sdate% >> P:\LDN-Results.txt
echo Result : RE_CBROL_LDN_JET_OTH having errors! >> P:\LDN-Results.txt
echo. >>"P:\LDN-Results.txt"
)
)
Notepad.exe "P:\LDN-Results.txt"
:END
@ECHO ========== Batch File Finished ============
PAUSE>nul



Discussion

No Comment Found