Wednesday, 25 August 2010

Powershell script to purge files

The following powershell script will allow you to delete all files in the current directory, and any subdirectories, older than 3 months old. I would suggest sticking it in a script and automating it.

gci -r *.* | ? {$_.lastwritetime -lt (get-date).addmonths(-3)} | ri

No comments:

Post a Comment