5
I'm looking to automatically delete files older than 7 days old with forfiles
.
The code below works when I do it manually and respond yes to deleting the files. How can I incorporate the yes into this?
This is the output:
E:\>forfiles -p "H:\SHARED\Scans" -s -m *.* -d -7 -c "cmd /c del @path"
Could Not Find H:\SHARED\Scans\.DS_Store
H:\SHARED\Scans\XXX\DOC006.XSM\*, Are you sure (Y/N)?
Note that contrary to what MS docs say,
/m *.*
inforfiles
does not match all files. It will only match files whose names have an extension. If you want to match all files, you need/m *
. Or just omit/m
entirely, since/m *
is the default. – AnT – 2018-01-16T02:13:26.1301what happens when you try echo y | before it? – barlop – 2011-01-05T16:30:46.227