Over time, your Windows 11 PC accumulates tons of unnecessary files—temporary logs, old downloads, leftover update files, unused documents, and more. These files not only take up precious storage space but can also slow down your system if not cleaned regularly. Manually deleting old files is time-consuming, which is why many users prefer automatic cleanup tools built directly into Windows.
If you’re here reading this guide, you’re probably looking for a way to let Windows 11 automatically delete older files without needing to remember it yourself. The good news? Windows includes multiple built-in tools—like Storage Sense, Automatic User Folder Cleanup, and Temp File Cleanup—that can remove old files at regular intervals.
In this detailed, step-by-step guide, we’ll show you every method to automatically delete old files on Windows 11, whether you want to clean temp files, downloads, recycle bin content, or custom folders.
1. Use Storage Sense to Automatically Delete Old Files (Best Method)
Storage Sense is Windows 11’s built-in automatic cleaning utility. It removes temporary files, old downloads, recycle bin items, and other system debris.
Enable Storage Sense
- Open Settings on your PC.
- Go to System → Storage.
- Turn on:
Storage Sense
Once enabled, Windows automatically begins managing unnecessary files.
2. Configure Storage Sense for Automatic Cleanups
To take full control, you can customize how Storage Sense cleans your storage.
- Under Storage Sense, click:
Configure Storage Sense or run it now - You’ll see multiple cleanup options:
Run Storage Sense Automatically
Under Run Storage Sense, choose one of the following frequencies:
- Every day
- Every week
- Every month
- During low free disk space
For automatic cleanup, set:
Every week or Every day
Delete Temporary Files Automatically
Turn on:
Delete temporary system and app files
Windows will remove cached data, temp logs, and old update files without affecting your apps.
Auto-delete Recycle Bin files
Under Delete files in my recycle bin if they have been there for over:
Choose:
- 1 day
- 14 days
- 30 days
- 60 days
This ensures deleted files don’t pile up forever.
Auto-delete old files in the Downloads folder
Under:
Delete files in my Downloads folder if they haven’t been opened for:
Choose a time limit:
- 1 day
- 14 days
- 30 days
- 60 days
Note: Be careful—important files might be deleted if untouched for long.
Run Cleanup Manually Anytime
At the bottom, click:
Run Storage Sense now
This forces a cleanup immediately.
3. Automatically Delete Old Temp Files via Disk Cleanup
Disk Cleanup still exists in Windows 11 and can be automated using Task Scheduler.
Steps to create an automated cleanup task:
- Press Windows + S and type:
Task Scheduler - Open it.
- Click Create Basic Task.
- Name it:
Auto Temp File Cleanup
Set Trigger:
- Choose Daily or Weekly.
- Set a suitable time.
Set Action:
- Choose:
Start a program - In the Program field, type:
cleanmgr.exe - In Add arguments, enter:
/sagerun:1
You must first configure preset “1” by running:
- Press Windows + R → type:
cleanmgr /sageset:1 - Choose which temp files to delete.
- Save settings.
Windows will now automatically delete temp files on the schedule you set.
4. Automatically Delete Files in Specific Folders Using PowerShell Script + Task Scheduler
If you want Windows to automatically delete files older than a certain number of days from any custom folder, you can use a PowerShell script.
Create a PowerShell Cleanup Script
- Open Notepad.
- Paste the script below:
$Path = "C:\YourFolder"
$Days = 30
Get-ChildItem -Path $Path -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-$Days))} | Remove-Item -Force
- Replace:
- C:\YourFolder → folder to clean
- 30 → number of days
- Save as:
DeleteOldFiles.ps1
Schedule the Script to Run Automatically
- Open Task Scheduler.
- Click Create Task.
- Under “Triggers,” set how often you want the script to run.
- Under “Actions,” choose:
Start a Program - For Program/script, enter:
powershell.exe - For “Add arguments,” insert:
-ExecutionPolicy Bypass -File "C:\Path\DeleteOldFiles.ps1"
Now Windows cleans that folder automatically based on your schedule.
5. Automatically Delete Old Cloud Files (OneDrive + Windows 11)
OneDrive includes automatic cleanup for files set to “online-only.”
- Open OneDrive Settings.
- Go to Sync and backup → Advanced settings.
- Enable:
Files On-Demand
This removes local copies of unused cloud files while keeping them online.
6. Use Third-Party Cleanup Tools (Optional)
If you want more control or automation features, tools like:
- CCleaner
- BleachBit
- Wise Disk Cleaner
Allow you to schedule deletion of old browser files, logs, and junk automatically. But for most users, Windows 11’s built-in options are more than enough.
Wrapping Up
And that wraps up our in-depth guide on how to automatically delete old files on Windows 11. Whether you use Storage Sense, Task Scheduler, PowerShell scripts, or cloud cleanup tools, Windows gives you plenty of powerful ways to keep your system clean without manual effort.