🧹 Auto Folder Cleaner (PowerShell Script)
Automatically delete all files in a folder—great for temp, downloads, or cache cleanup!
🔧 Features
-
Deletes all files in a specified folder
-
Excludes subfolders (safe by default)
-
Simple and lightweight
-
Works on all Windows systems with PowerShell
-
Easy to schedule via Windows Task Scheduler
📦 What’s Included
-
AutoFolderCleaner.ps1
— the PowerShell script -
README.txt
— step-by-step setup instructions -
Email support — aiswing.com@gmail.com
🛠️ How to Use
-
Open the script file in a text editor (like Notepad)
-
Edit the folder path inside the script (
$targetFolder
) -
Save the file
-
Run the script manually OR schedule it to run using Windows Task Scheduler
❗ If You See a Security Error When Running the Script
Windows may prevent the script from running due to execution policy or file download security. Here’s how to fix it:
🔓 Unblock the file (required only once)
Option 1 – via File Explorer:
-
Right-click on the
.ps1
file → Properties -
Check the box for “Unblock” at the bottom (if visible), then click OK
Option 2 – via PowerShell command:
🔐 Allow script execution (only needs to be done once)
Open PowerShell and run:
💡 You do not need admin rights for this.
Or run the script like this (no policy change needed):
⚠️ Warning
This script permanently deletes all files in the target folder.
Be sure to test with dummy files before using it in important folders.