Do you have a temporary directory on your pc/server, you know one of those places where you put stuff to look at later but always forget to delete again?  It is likely that your answer is yes, but the more important question ought to be how do I automate cleanup of this directory?

There are numerous ways to do this, but I’ll just give you one here – google the rest if you are not satisfied..

It’s actually not as hard as it sound, you need to download a utility called “forfiles.exe” (put  it in c:\windows\system32 or similar) and then create a script much like this (here I presume the directory to cleanup is C:\tempdata);

rem Delete files on the server older than 14 days.
forfiles -p c:\tempdata-s -d -14 -c "cmd /c del /Q /F ""@FILE"""
rem Delete files older than 90 days
forfiles -p c:\tempdata-s -d -90 -c "cmd /c del /Q /F ""@FILE"""

And that is about it 🙂