This can be done via Perl or a number of other languages which have abilities to compare strings, but I cant see doing this in raw batch.
It is a commonplace everyday task for batch. It can easily be done... using FOR and the ~t variable modifier you can get the "date" (created or last modified?) of each file, and it is trivially easy to get today's date.
However we do not know the OP's local date format or the format returned on his system by ~t
The output of this script will tell us those things.
@echo off
echo local date format [%date%]
echo.>temp$$$
for /f %%A in ("temp$$$") do echo file date format [%%~tA]
del temp$$$
pause
For example, I get this
local date format [22/09/2010]
file date format [22/09/2010 07:46 AM]
But I am worried about this in the question
I need a batch file to search in a directory. If all the files have the current date stamp then execute command1 if files are not current then execute command2.
thank you.
All the files? What if 99 do and 1 does not? Likewise for the converse situation.