Showing posts with label delete files with script. Show all posts
Showing posts with label delete files with script. Show all posts

Tuesday, January 5, 2010

How to auto delete files older than 5 days

Here's how to auto delete files older than 5 days. Open Notepad, enter the following:
Forfiles -p C:\backup -s -m *.* -d -5 -c "cmd /c del @path"

Save as something like: RecycleBinCleaner.cmd

Then create a service account in AD or a local user account with admin rights on the local IIS box and setup a Windows  Schuduled task to run it every night using that account.

 Bedeep, bedeep, bedeep... that's all folks! :)