I'm trying to set a daily process to locate a file, rename it and insert the previous date in the file name. I want the file to be named "Filename_MMddyyyy.csv" with MMddyyyy being the previous day. I managed to rename the file but I'm a total noob and I don't know how to calculate the previous day date and insert it in the file name. Here is what I managed to do so far:
cd C:\
set file= \\pathtothefile\*.CSV
if exist %file% (
ren \\pathtothefile\*.CSV Filenamehere_%date:~10,4%%date:~7,2%%date:~4,2%.CSV
)