if not exist doesn't seem to be working
Posted: 01 Apr 2014 22:20
hi guys,
i can't to get it to work,
for /F "tokens=1*" %%i in (%File_dbname%) do (
for %%A in (%%j) do (
echo **********************************************************************>>%output-file%
echo %%A DB daily check ORA-ERROR at %%i>>%output-file%
echo **********************************************************************>>%output-file%
echo .>>%output-file%
echo .>>%output-file%
REM if NOT exist alert_%%A.log (
REM echo alert_%%A.log Not found>>%output-file%
REM )
:: print out all ORA- errors along with their associated timestamps
findstr /br "Sun\> Mon\> Tue\> Wed\> Thu\> Fri\> Sat\> ORA-[0-9]*" alert_%%A.log|findstr /r "!LF!ORA- ^ORA-">>%output-file%
If ERRORLEVEL 1 echo NO ORA- error found in alert_%%A.log>>%output-file%
echo .>>%output-file%
echo .>>%output-file%
IF NOT EXIST alert_%%.log echo no new alert_%%A.log generated>> %output-file%
)
)
basically is when it loop through the list of files (which is dynamically) and if that particular files is not found, it will says that particular log is not generated yet.
please help.
i can't to get it to work,
for /F "tokens=1*" %%i in (%File_dbname%) do (
for %%A in (%%j) do (
echo **********************************************************************>>%output-file%
echo %%A DB daily check ORA-ERROR at %%i>>%output-file%
echo **********************************************************************>>%output-file%
echo .>>%output-file%
echo .>>%output-file%
REM if NOT exist alert_%%A.log (
REM echo alert_%%A.log Not found>>%output-file%
REM )
:: print out all ORA- errors along with their associated timestamps
findstr /br "Sun\> Mon\> Tue\> Wed\> Thu\> Fri\> Sat\> ORA-[0-9]*" alert_%%A.log|findstr /r "!LF!ORA- ^ORA-">>%output-file%
If ERRORLEVEL 1 echo NO ORA- error found in alert_%%A.log>>%output-file%
echo .>>%output-file%
echo .>>%output-file%
IF NOT EXIST alert_%%.log echo no new alert_%%A.log generated>> %output-file%
)
)
basically is when it loop through the list of files (which is dynamically) and if that particular files is not found, it will says that particular log is not generated yet.
please help.