Page 1 of 1

forfiles used with echo modifiying date modified?

Posted: 19 Dec 2020 10:53
by SIMMS7400
Hi Folks -

I'm trying to use forfiles logic to echo the content that meets the specified criteria which I want to leverage in a logfile. I then want to have a second forfiles setup to actually delete that content. However, the first forfiles seems to be changing the date modified. Is there a way to get around that?

Code: Select all

	FOR /F "tokens=*" %%a IN (
		'FORFILES /P "!STRING!" /S /D -!AGE! /C "cmd /c IF @ISDIR == TRUE ECHO @path"^
			2^>^&1 ^| FINDSTR /I ERROR'
	) DO SET "CMDRSLTECHO=%%a"

Code: Select all

	FOR /F "tokens=*" %%a IN (
		'FORFILES /P "!STRING!" /S /D -!AGE! /C "cmd /c IF @ISDIR == TRUE RD /S /Q @path"^
			2^>^&1 ^| FINDSTR /I ERROR'
	) DO SET "CMDRSLT=%%a"
Thanks!

Re: forfiles used with echo modifiying date modified?

Posted: 01 Jan 2021 04:54
by SIMMS7400
Hi folks, is there another way to go about this to meet my need? Thanks!