Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FORFILES not including today's files is not working

Tags:

batch-file

Reading on the page: http://blogs.msdn.com/b/oldnewthing/archive/2012/08/03/10334560.aspx

We see that he discusses: the use of /D +0 and it would stand to reason to use /D -0 to not include today's created files.

I am in the midst of working on a web archive project and pretty close on this..

FORFILES /P D:\logs\ /M dump.log* /D -0  /C "cmd /c ECHO @file"
FORFILES /P D:\logs\ /M server.log* /D -0  /C "cmd /c ECHO @file"

In fact, I get the same results when using either /D -0 or /D +0

like image 420
Leptonator Avatar asked Sep 17 '25 16:09

Leptonator


1 Answers

/D is a date offset. Usually, it is followed by a negative number that indicates that the command should be run on files with a last modified date less than or equal to the specified offset. In extremely rare cases, a +0 can be used on files whose last modified date is somehow after today.

To ignore today's files when processing, use /D -1 to process all other files... unless you have files from the future.

like image 143
SomethingDark Avatar answered Sep 19 '25 06:09

SomethingDark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!