Old File Auto Deleter (PowerShell Script)
Automatically clean up old files in any folder — keep your system organized and free up valuable space.
What It Does
-
Scans a folder of your choice
-
Deletes all files older than a specified number of days (default: 30 days)
-
Optionally includes subfolders
-
Great for cleaning temp, logs, old downloads, and backup folders
-
Works with any file type
-
Simple to configure and safe to use
How to Use
-
Open the script in Notepad or any text editor
-
Modify these lines at the top of the script:
-
$targetFolder
= the folder you want to clean -
$daysOld
= number of days before deletion (e.g. 30) -
$includeSubfolders
=$true
or$false
depending on whether you want to clean inside subfolders
-
-
Save the file
-
Right-click the script → “Run with PowerShell”
You can also schedule the script to run automatically using Windows Task Scheduler.
Troubleshooting (if script won’t run)
If you get a message like “…cannot be loaded because it is not digitally signed…”, run this command once in PowerShell:
To unblock the downloaded file, right-click → Properties → check “Unblock” (if present), then click OK.
Alternatively, run the script with this one-time command:
What’s Included
-
OldFileAutoDeleter.ps1
— the script -
README.txt
— instructions and configuration guide -
Email support included (aiswing.com@gmail.com)
License & Terms
-
For personal or internal business use only
-
Redistribution or resale is not allowed