Windows Powershell / Script – Delete old files older then X days

forfiles -p "C:\what\ever" -s -m *.* /D -<number of days> /C "cmd /c del @path"

Source – Stackoverflow

For directories with millions of files…

dir |? {$_.CreationTime -lt (get-date).AddDays(-8)} | del -whatif

(remove the -whatif to make it happen). The whatif previews the changes.

Source – Server Fault