79489477

Date: 2025-03-06 13:18:20
Score: 0.5
Natty:
Report link

The issue is with how the /D option is used—it needs to be applied to the forfiles command directly, not inside the cmd /c part.

Try modifying your code like this:

echo off
forfiles /p "c:\users\J33333\Desktop\DDrive\test" /s /m "TS*.xmt" /D -30 /c "cmd /c del @file"
exit

Here's the breakdown:

This should delete only the files that match both criteria: filenames starting with "TS" and older than 30 days.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @file
  • User mentioned (0): @file
  • Low reputation (0.5):
Posted by: hmu535