Skip to main content

Delete 15 days old files using batch file

To delete 15 days old file using batch file

forfiles -p "C:\Testing\Backup"-s -m ”.” /D -15 /C "cmd /c del @path"


Suppose want to delete only txt file, then

forfiles -p "C:\Testing\Backup"-s -m ”.txt” /D -15 /C "cmd /c del @path"

Suppose want to delete 30 days old file then -30 instead of -15

Comments