|all the steps are easy (except no. one, of course. batchfiles can't plug things into|
the computer!) except for number 6, becuse then you get into the issue of...
along with the attendant confusions and conflicts of DATE FORMATs.
There are tons of code written to handle date math, in various languages and in
native batch (I've written a couple myself, one batch and a better one using vbscript). vbscript has date math built in (dateadd, datediff functions), so it is the best way, but you have to have cscript.exe available to interpret the vbscript.
if you have access to vis.basic, it has those same functions, and you can compile
it. The keep-it-simple method would be to manually update the critical date in
the batchfile or in a squibfile, but then someone needs to know to do that every day.
The other option, IF the file is newer than one day old, and IF the file is the same as
the one on the flash, just write over the file. But i'm assuming that's not the case
or it would not be so critical to do this date math.
here's a vbscript version:
if a < 0 then wscript.quit
for i=0 to a
if a=0 then
'use colon to interpret as time, else date
'sets defaults for date (diff in days) or time (diff in minutes)
if p>0 then s="n" else s="d"
'now allow overrides by token #1 if valid subset
if instr("dmwhns",lcase(d(0)))>0 then
'-------- end of script
it has features you don't need but might want to leave in there.
to use it in batch:
for /f %%a in ('cscript dd.vbs %filedate%') do set ddif=%%a
i swapped the dates so you wouldn't have to change the sign from negative.