I wanted one liner to delete all files older than 14 days in a specific folder.
This is my team
forfiles -px: \ logs -s -m * .log -d-14 -c "CMD / C del @file"
but when executed, its outputs “cannot execute (error 2)” for each file found. If -c "CMD / c del @file" is omitted, it works fine by creating a list of files older than 14 days. At first, I thought it might be a resolution problem; but any action in the file gives the same result, and I am the admin on comptuer.
However, this is a network resource if it makes a difference.
thank
source
share