Batch to check if a single file is modified

Solved/Closed
todd - Aug 1, 2010 at 08:44 AM
 todd - Aug 2, 2010 at 04:31 AM
HI, I'm not a programmer but I have to check in an external directory if a single file (myfile.avi) is modified or created today and if the answer is yes start another batch or quit.

I've found this code but does not work on my Win XP.
My date is DD/MM/YYYY.

@echo off
for %%F in (C:\TEST\myfile.avi) do (for /F %%D in ("%%~tF") do (set mdate=%%D)) for /F "tokens=2" %%D in ('date/t') do set cdate=%%D

if "%cdate%"=="%mdate%" start myprogram.bat



I hope someone can help me. Thank you in advance.
Related:

1 response

This solution works on my Win XP Home Edition where the date format is: "DD/MM/YYYY"

@echo off 
for %%F in (C:\TEST\myfile.avi) do (for /F %%D in ("%%~tF") do (set mdate=%%D)) 
for /F "tokens=1" %%D in ('date/t') do set cdate=%%D
echo cdate="%cdate%"  mdate="%mdate%" current dir=%cd%
if "%cdate%"=="%mdate%" start myprogram.bat
0