How to Automatically Delete Old Files in Windows 11?
Last Updated :
03 Jul, 2024
Managing storage space efficiently is crucial for maintaining a smooth and responsive system. Windows 11 offers built-in features to help you automatically delete old files, freeing up valuable disk space without manual intervention.
Whether you're looking to manage temporary files, downloads, or other unused files, our step-by-step instructions will help you keep your system clean and optimized.
4 Methods to Automatically Delete Old Files in Windows 11
In this guide, we'll show you how to set up automatic file deletion in Windows 11 using built-in tools and settings. With these easy steps, you can keep your storage clean and organized without the hassle of manually deleting files. Let's get started!
Method 1: Auto-Delete Old Files or Folders Using Storage Sense
The Settings’s Storage Sense feature automatically removes files or folders when storage space is running low.
Step 1: Press Win + I to open the settings app then navigate to System > Storage.

Step 2: Toggle on Storage Sense.

Step 3: Click the Storage Sense to customize its settings.
Step 4: In the Configure cleanup schedules section you can select the time frame that suits you best for running the Storage Sense option.
You have the option to run it every day, every week, every month or during low free disk space (which is the default setting).

Step 5: Once everything is configured, click the Run Storage Sense Now button

Method 2: Delete Old Files or Folders Using Command Prompt
You can use Command Prompt to delete old files or folders in Windows 11. This method is useful if you prefer to work with text commands. Follow these simple steps:
Step 1: Press Win + R on your keyboard. This will open the Run dialog.
Step 2: Type cmd into the Run dialog. Press Ctrl + Shift + Enter.

Step 3: In Command Prompt, Type this command "ForFiles /p "C:\path\to\folder"/s /d -30 /c "cmd /c del /q @file"" to delete files older than 30 days in a specific folder.
Step 4: Hit Enter to delete the file or folder
Remember to use this method with caution, as the files or folders you delete using Command Prompt cannot be easily recovered. Make sure to review the files you want to delete before running the command.
Method 3: Delete Old Files or Folders Using Task Scheduler
Using Task Scheduler in Windows 11, you can set up a task to automatically delete old files or folders on a regular schedule. This method can be helpful for keeping your system tidy without manual intervention. Here's how to set it up:
Step 1: Press Win + S then on the search bar type “Task Scheduler”

Step 2: Right Click on “Task Scheduler Library” then click on “New Folder”

Step 3: Enter any name you want and click OK.
Step 4: Right Click on the newly created folder then click on “Create a task”

Step 5: Enter any you want in the name field then enable the Run whether the user is logged on or not.
.jpg)
Step 6: Select your preferred schedule for running the task and click OK. Then, Navigate to the “Actions” tab.
Step 7: In the actions tab click on “New” then on Program/scripts field type this command “ForFiles /p “old file path”/s /d -30 /c “cmd /c del /q @file””
Step 8: Replace "old file path" with your desired directory, and use -30 to represent the last modified time, as an example:
ForFiles /p “C:\Users\Saurabh\Documents\New folder” /s /d -30 /c “cmd /c del /q @file”

Step 9: Click Ok. Then, Navigate to Settings tab and check the following checkboxes:
- If the task fails, restart every.
- Run tasks as soon as possible after a scheduled start is missed.
Using Task Scheduler is a great way to automate the deletion of old files or folders in Windows 11, helping you maintain a clean and efficient system.
Method 4: Delete Old Files or Folders Using Microsoft PC Manager
Using Microsoft PC Manager is an easy and convenient way to automatically delete old files or folders in Windows 11. This tool offers a straightforward way to manage and optimize your system's storage. Here's how you can use it:
Step 1: Open Microsoft store then on search bar type “Microsoft PC Manager” then click on “Get” on right side pane

Step 2: After installing open Microsoft pc manager
Step 3: In PC Manager, Click on Settings on the left side pane.
Step 4: Toggle the Smart Boost

By using Microsoft PC Manager, you can easily manage your storage and delete old files or folders without hassle. This method is a great option for those who want a user-friendly way to optimize their Windows 11 system.
Conclusion
Automatically deleting old files in Windows 11 is a straightforward process that can significantly improve your system's performance and free up storage space. By following the steps outlined in this guide, you can set up automated file cleanup and ensure your computer remains clutter-free. Take advantage of Windows 11's built-in tools to maintain a clean and efficient system effortlessly.
Similar Reads
How to Recover Accidentally Deleted File in Windows 11?
Accidentally deleting important files on Windows 11 can be frustrating and stressful. Fortunately, there are several effective methods to recover those lost files and restore your data. Whether youâve emptied the Recycle Bin or the files were deleted permanently, this guide will walk you through the
5 min read
How to Delete Temporary Files in Windows 10?
Over time, temporary files in Windows 10 can accumulate and take up valuable disk space, potentially slowing down your system. These files are usually created by various applications for short-term use, but they can linger long after they're needed. Knowing how to delete temporary files in Windows 1
7 min read
How to automatically delete/remove files older than x days in Linux
Linux operating systems are widely used for web servers and other data-heavy tasks such as penetration testing etc. In these applications, there can be an accumulation of files that are not useful after a certain period. Now Linux, being an operating system used mostly for its automation functionali
9 min read
How to Create a Batch File in Windows?
A batch file is a straightforward text document in any version of Windows with a set of instructions meant to be run by Windows' command-line interpreter (CMD) by maintaining all the functions. Batch files are a great tool for streamlining internally configured processes, automating tedious jobs, an
5 min read
How to Open File Explorer in Windows 11?
Short Preview!Here is a short preview of our active and speedy learner. Follow these steps to open File Explorer on your Windows PC. Method 1: Simply Type "File Explorer" in the search bar.Method 2: press the "Windows key + E."File Explorer will open, allowing you to manage files and folders in Wind
4 min read
How to Clear Cache in Windows 11
Are you noticing that your Windows 11 system is slowing down or taking up too much storage space? One of the most effective ways to speed up your computer and free up space is by clearing the cache. Over time, temporary files, browser cache, and other cached data can build up and cause performance i
6 min read
How to Customize Desktop Icons in Windows 11?
Customizing desktop icons in Windows 11 allows you to personalize your workspace, making it visually appealing and better organized. Whether you want to change the appearance of system icons, add new icons, or adjust their size and spacing, Windows 11 provides several options to help you achieve you
5 min read
How to Create a Copilot Desktop Shortcut in Windows 11
Windows 11 emerges as a trailblazer, introducing a groundbreaking feature that sets it apart from its predecessors. Enter Windows Copilot, a built-in AI assistant that transforms the user experience by providing centralized AI support directly within the operating system. This marks a significant le
8 min read
How to Zip and Unzip Files in Windows 11?
Zipping and unzipping files is a common task that helps reduce file size or bundle multiple files together for easier sharing. In this guide, we'll cover 3 easy methods to zip and unzip files in Windows 11 for free. Whether you're using built-in features or looking for quick ways to compress files i
4 min read
How to Disable OneDrive in Windows 11?
OneDrive is a cloud storage option that comes pre-installed in Windows 11, providing easy access to file storage and the ability to sync these files across devices. Nonetheless, not everyone requires or desires to utilize OneDrive, particularly if they opt for other cloud storage options. Removing O
4 min read