I've got a batch script and it needs to delete archive folders that are older than 4 days. Here are the steps the batch files does (extreme pseudocode):
Delete archive folders older than 4 days
Create archive folder for today ("04_05_2007")
Run DB macro to extract files
Send files to new location
Copy files to newly created archive folder ("04_05_2007")
I'm fairly new to batch scripting and am re-using someone else's code to try to learn how to do this. Here is how he is getting the date for today and creating the directory:
SET archivedir="C:\Corp\Mrktg\Production\CARAT Extract\Archive"
CD /D %archivedir%
Is there a way to build off of this existing code? Some way to say %CurrDate%-4 or %CurrDay-4% (which does not work by the way) and then delete that specific directory that is 4 days old? This is a process that will run everyday so during each run there should only be one directory that is being deleted, the one exactly 4 days old.
I appreciate any help in this area. I've looked around and seen some batch solutions for things like CALL: SUBTRACTDAYS but don't see how that can be tailored to fit the current way I'm getting the date.