Delete Files and Folders Older Than X Days

Often times admin have to creates tasks like removing log files or some other files on a regular schedule. Here is an automated way of removing files / folders older than X days.

Create a Batch file or Powershell script and add it to scheduled task.

Please check permissions on the files and folders. If you have unique or specialized permission on the file or folders these wont work.

Batch File:

Powershell: