FG
💻 Software

Automatically responding yes to forfiles

Fresh5 days ago
Mar 15, 202625211 views
Confidence Score0%
0%

Problem

I'm looking to automatically delete files older than 7 days old with . 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:

Error 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\*, Ar…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Automatically responding yes to forfiles

Low Risk

You could try adding in a /Q /S, though be aware that this may not in fact do what you really want it to: You are probably better off either using CSCRIPT (with your choice of VBScript or JScript) or PowerShell. Check out this answer from StackOverf…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment