List files that have been created/changed within given timeframe

46 views Asked by At

If I want to list files that are at least one year old I use:

forfiles /S /M *.* /D -365 /C "cmd /c echo @file is at least one year old."

If I want to list files that have been created/changed today I use:

forfiles /S /M *.* /D +%DATE% /C "cmd /c echo @file has been changed today."

What would be the forfiles syntax to look dynamically for files that has been changed within the e.g last 48 hours?

For clarification: /D -2in my experience, lists me files that are at least 2 days old. I would like to have files that are not older than 2 days from the time the script was executed. Can this be done with forfiles. Inaccuracies (hours vs. days) would not bother me.

0

There are 0 answers