Here's a simple PowerShell script to delete files and folders older than 1 month from my Downloads folder:

ls ~\Downloads | where {($_.LastWriteTime).AddMonths(1) -lt (get-date)} | remove-item -force -recurse

The script deletes items older than 1 month as-is, but this can be adjusted by changing the call to AddMonths appropriately (there are other methods on the date object such as AddDays, AddHours, AddMinutes, etc).

The script calls ls (alias for Get-ChildItem) on my Downloads folder. The output is piped to a where clause that filters on the LastWriteTime property of the current object or $_ (pipline variable). One month is added to LastWriteTime, and if it's less than (-lt) the current date then it's piped to remove-item (which has aliases of rm and rmdir) where the file/directory is forcefully removed without prompt and contents in directories is recursively deleted.

This can be called manually every now and then or can be scheduled with Windows task scheduler.

Although this can be done using the forfiles command in the normal Windows command prompt, I had trouble deleting folders using it and PowerShell is more flexible overall.

Surprisingly, this was hard to find after a little Googling around. It seems to be that way with PowerShell samples, and I hope that's just because it's still relatively new.