.EXAMPLE.....: 32 Display a list of all files that were created/updated today.
.ALIAS.......: 32
.CATEGORY....: examples
.CODE........:
@echo off
if (%1)==(SUBROUTINE) goto %2
CLS
echo FILES MEETING FILESPEC [%1] THAT WERE CREATED OR UPDATED TODAY
:: The batch file calls itself: Its own name is in parm %0
for %%v in (%1) do CALL %0 SUBROUTINE CHECKFILE %%v
set comp=
goto endit
:CHECKFILE
shift
shift
:: Compare today's date to the date on the %1 file
Fdate /Fcomp /If /A%1 /Vcomp
:: echo the filename if the file was created/updated today
if (%comp%)==(EQ) echo %1
:endit
:33 MIN_MATH.BAT -- "time arithmetic" in minutes
.CODE........:
@echo off
cls
:: MIN_MATH.BAT -- Add or subtract time, in minutes, from the present
:: Get number of minutes from parm1, if present. otherwise, use 4 minutes
:: not that Minutes can contain a negative number, if we wish to subtract
:: some minutes
set Minutes=4
if not (%1)==() set Minutes=%1
:: get the absolute minute NOW
:: Alternatively, you can use the /A parm and the /T parm
:: to start from the date and time of your choice.
fdate /ff /ominute# /vAbsMin
:: add a certain number of minutes
fdate /f#add /a%AbsMin% /b%Minutes% /VNewMin
:: display the results
fdate /ff /iminute# /ofull /a%AbsMin% /p"We add %Minutes% minutes to "
fdate /ff /iminute# /ofull /a%NewMin% /p"producing: "
set Minutes=
set AbsMin=
set NewMin=
echo.
:endit
:34 TIME_SET.BAT -- "time arithmetic" -- set TIME
.CODE........:
@echo off
:: advance the time by 3 hours, then set it back again
set Minutes=180
cls
FDATE /FF /Ofull /P"It is now "
:: get the absolute minutes now
fdate /ff /ominute# /vAbsMin
:: add a certain number of minutes
fdate /f#add /a%AbsMin% /b%Minutes% /VNewMin
:: reset the time and date
fdate /ff /a%NewMin% /Iminute# /omm-dd-yy /vdate
fdate /ff /a%NewMin% /Iminute# /ohh:mm /vtime
time %time%
date %date%
echo %Minutes% minutes added...
FDATE /FF /Ofull /P"It is now "
echo.
echo DOING SOME WORK ...
echo.
FDATE /FF /Ofull /P"It is now "
:: get the absolute minutes now
fdate /ff /ominute# /vAbsMin
:: subtract (add negative) a certain number of minutes
fdate /f#add /a%AbsMin% /b-%Minutes% /VNewMin
:: reset the time and date
fdate /ff /a%NewMin% /Iminute# /omm-dd-yy /vdate
fdate /ff /a%NewMin% /Iminute# /ohh:mm /vtime
time %time%
date %date%
echo %Minutes% minutes subtracted ...
FDATE /FF /Ofull /P"It is now "
set Minutes=
set AbsMin=
set NewMin=
set time=
set date=
echo.
:endit