1.

Solve : If It EXIST with Modified Date of Today?

Answer»

Hello all,

How can I verify the Modify date of a particular file through batch.
I want my batch file to say if this file (testfile.txt) exist then ckeck the modify date and if the modify date is TODAY's date, then continue (ie. copy file to a nother folder) ELSE stop the batch process and GIVE a prompt with "file not found - batch processed STOPPED" or "file does not have the expected modify date - batch processed stopped".

THANK you for your help.Code: [Select]@echo off

if not exist testfile.txt goto NOT-EXIST
for /f %%D in ('dir /tw ^| find "testfile.txt"') do set MODIFY=%%D
set TODAY=%DATE:~-10%

if %MODIFY%==%TODAY% copy testfile.txt another_folder/
goto END

echo file does not have the expected modify date - batch processed stopped
goto END

:NOT-EXIST
echo file not found - batch processed stopped

:END



Discussion

No Comment Found