Batch File to check Modified date

January 6, 2010 at 13:42:38
Specs: Windows XP
I need help with creating a batch file that will check the date modified of an excel file, if the file is today's date, do nothing, else run program.exe. Any help would be appreciated.

See More: Batch File to check Modified date

Report •


#1
January 6, 2010 at 14:12:47
@echo off > %TEMP%\#-#
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in ('dir/b/s %TEMP%\#-#') do (
set mydate=%%~Ta
)

for /f "tokens=1 delims= " %%a in ("!mydate!") do (
set today=%%a
)

for /f "tokens=* delims= " %%a in ('dir/b/a-d my.xls') do (
set TD=%%~Ta
for /f "tokens=1 delims= " %%a in ("!TD!") do (
set filedate=%%a
)
if !filedate! neq !today! echo process %%a
)


=====================================
Helping others achieve escape felicity

M2


Report •
Related Solutions


Ask Question