1

I'm working with the forfiles command

I am attempting to get a list of files newer than X days ago.

When I use the /D +X command I get a not files found error:

forfiles /P %filename% /D +3

However if I use a date it works fine:

forfiles /P %filename% /D +06/29/2016

Am I missing something on the +X formatting? It seems like it is adding 3 days to the current date and then looking for files newer than that.

Or is there a simpler way to increment the date than I'm aware of. Only work with Batch once in a while

I don't want to use vbs, and I would rather not have a set of code longer than the rest of my script just to get the date, there should be a simpler way.

double-beep
  • 5,031
  • 17
  • 33
  • 41
  • 2
    Possible duplicate of [FORFILES date -after- (date calc in cmd file)](http://stackoverflow.com/questions/19296588/forfiles-date-after-date-calc-in-cmd-file) – aschipfl Jul 01 '16 at 22:42
  • The `/D +X` command does not seem to work. This means you have to try another method that requires trickier syntax. – Ben Apr 25 '22 at 14:59

0 Answers0