Open In App

How to Automatically Delete Old Files in Windows 11?

Last Updated : 19 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Automatically deleting old files in Windows 11 can help you manage your storage space more efficiently and keep your computer running smoothly. Over time, files can accumulate and take up valuable storage space, especially large or unneeded files such as downloads, temporary files, or old backups. By setting up automatic file deletion, you can free up space on your hard drive and improve your system’s performance.

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.

Automatically Delete Old Files

Step 2: Toggle on Storage Sense.

Automatically Delete Old Files

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).

Automatically Delete Old Files

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

Automatically Delete Old Files

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.

Automatically Delete Old Files

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”

Automatically Delete Old Files

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

Automatically Delete Old Files

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”

Automatically Delete Old Files

Step 5: Enter any you want in the name field then enable the Run whether the user is logged on or not.

Automatically Delete Old Files

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””

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”

Automatically Delete Old Files

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

Automatically Delete Old Files

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

Automatically Delete Old Files

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

In conclusion, we have shown four methods for automatically deleting old files or folders on Windows 11. These methods involve utilizing Storage Sense, Command Prompt, Task Scheduler, and Microsoft PC Manager. These methods allow you to enhance your computer’s performance, free up storage space, and protect your privacy.

How to Automatically Delete Old Files in Windows 11?- FAQs

How do I mass delete files in Windows 11?

Navigate to the folder containing the files you want to delete. Holding Ctrl and clicking individual files and then Click on the first file, holding Shift, and clicking the last file after that Right-click on any of the selected files and choose “Delete.”

How do I delete files over 7 days old?

Open the command prompt and type the following: ForFiles /p “C:\Users\Saurabh\Documents\New folder” /s /d -7 /c “cmd /c del /q @file”. and change the file path to the file path that you want to delete

Which Windows Settings feature allows you to automatically delete old files?

Storage Sense is a Windows 11 feature that frees up space on your system.

Why my files are automatically deleting?

If your files are disappearing, check these areas: Storage Sense settings, third-party cleanup tools, and scheduled tasks. Also, run a virus scan and review user settings for auto-delete options. Look for any scripts or automations that might be deleting files. Investigate these areas to stop your files from vanishing.

How do I automatically delete old files in Google Drive?

You can automatically delete old files in Google Drive using a Google Apps Script that sets files older than a specified number of days to be trashed. Set up a trigger to run the script on a schedule.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads