I have a file by the name yyyymmddFile1.txt where date prefix is added in a particular format.
I need to copy that file from one location to another and I need to pick today's and yesterday's file
For today, I wrote
SET TODAY=%date:~10,4%%date:~4,2%%date:~7,2%
SET MAINPATH=D:\%TODAY%File1.txt
if exist %MAINPATH% (
COPY D:\%TODAY%File1.txt D:\NDM\InFileQueue\%TODAY%File1.txt
)
so, This will set the filename to 20190502File1.txt
But I can't figure out how to pass yesterday's date as a variable. I need to do something like this -
SET YESTERDAY= ??
SET MAINPATH=D:\%YESTERDAY%File1.txt
if exist %MAINPATH% (
COPY D:\%YESTERDAY%File1.txt D:\NDM\InFileQueue\%YESTERDAY%File1.txt
)