Wednesday, May 20, 2020

Delete old file command line script for Schedule Task

Create your batch file.
Schedule a task with a trigger to delete the files you wish.

Example Script:

ForFiles /p "C:\dev\CardsDirect\Development\Preview\PlateFiles" /s /d -5 /c "cmd /c del @file"
ForFiles /p "C:\dev\data\Project Outputs\PlateFiles\Production" /m *.jpg /s /d -5 /c "cmd /c del @file"
ForFiles /p "C:\dev\data\Project Outputs\PlateFiles\Production" /m *.pdf /s /d -5 /c "cmd /c del @file"