@ECHO off REM dir-comp.cmd REM WRITTEN by David Cain REM 27-08-2008 REM Last Edited DMC 07-01-2011 Complete rewrite to only send file on a Friday REM SETLOCAL ENABLEEXTENSIONS SET TestDay=Fri set logfile=%~dp0dir-comp.log %~dp0NOW.EXE Beginning Directory Comparison Transfer dir-comp.cmd > %logfile% rem Create the date and time elements. For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do ( For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do ( set dow=%%i set %%a=%%j set %%b=%%k set %%c=%%l set hh=%%m set min=%%n set ss=%%o ) ) IF /I X%dow%X==X%TestDay%X GOTO makeitso goto wrongday :makeitso echo It's %dow% so a directory will be emailed >> %logfile% 2>&1 %~dp0blat -body "Today's Directory" -to servicedesk@victrack.com.au -subject "Today's Directory" -attach VRT-Directory.csv >> %logfile% 2>&1 REM Following line is debug only %~dp0bmail -s s-vm-exch01 -t david.cain@victrack.com.au -f s-vm-utility01@victrack.com.au -h -a "%dow% dir-comp sent" -b "It's %dow% and the dir-comp directory comparison was sent to ServiceDesk - refer http://s-vm-utility01/dirlogs.php" >> %logfile% 2>&1 GOTO fin :wrongday echo It's not %TestDay% >> %logfile% 2>&1 REM Following line is debug only %~dp0bmail -s s-vm-exch01 -t david.cain@victrack.com.au -f s-vm-utility01@victrack.com.au -h -a "%dow% dir-comp NOT sent" -b "It's %dow% so NO dir-comp directory comparison was sent to ServiceDesk - refer http://s-vm-utility01/dirlogs.php" >> %logfile% 2>&1 GOTO fin :fin %~dp0NOW.EXE *** Job Finished *** >> %logfile% endlocal