Script to monitor number of file in a Folder

Posted: July 27, 2010 in Bat Scripts

This script will monitor and count file number in a givven folder . If that count reach the thresold level of 15,
It will popup a message on screen and send an email to specifil email account .For sending email you need to install “bmail” program
for windows and put bmail.exe in c:\
@echo off
set _Count=0
for /F “tokens=1,2 delims= ” %%i in (‘dir F:\labvalapp\comms\solar2labval’) do if (%%j)==(File(s)) set _Count=%%i
if (%_Count%)==() goto EXIT
if %_Count% LEQ 15 goto EXIT
echo “Please Check……there is some problem in Auto Validation in MINOS”
cd c:\
bmail -s -t -f -b ” Please check Auto Validation” -a ” Problem in Minos Auto Validation”
set _Count=


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s