1.

Solve : Batch job sends email if file contains data???

Answer»

The following BATCH FILE works (with the real email addresses). I need to have it instead of check if there is a file named open_dt_events.txt, check to see if there is data in the file...the file is always GENERATED, I only need to send the email when there is data in the file.
I was thinking of checking if filesize was greater than 0 or something like that but I've had no luck so far and I've WASTED a whole morning on this.
Any help would be appreciated by this novice...
Thanks...
---------------------------------
d:
cd \open_dt_events

REM **** ROTATE THE LOG ****
if EXIST d:\open_dt_events\open_dt_events.txt goto nextstep

:nextstep
cd \open_dt_events
blat d:\open_dt_events\open_dt_events.txt -to [emailprotected] -subject "Open

Downtime Events Exist in HospitalNet Database" -f [emailprotected]

REM **** CLEANUP ****
del d:\open_dt_events\open_dt_events.txt

:end
--------------------------------------This is OS dependent:

Code: [Select]
for /f %%a in ('dir /b d:\open_dt_events\open_dt_events.txt') do (if not %%~za==0 goto nextstep)


If this doesn't work on your machine, you will have to work from a dir listing.

Hope this helps.



Discussion

No Comment Found