How to Automatically Delete Old Files on Windows 10 / 11 - Step-by-Step Guide

Managing disk space is a commonplace undertaking for lots of Windows users. Over time, old and useless documents can accumulate, taking up valuable storage areas. Manually deleting these files may be time-consuming and tedious. Fortunately, Windows 10 and eleven provide several built-in gear and methods to robotically delete old files, making sure your gadget remains clean and efficient. In this guide, we’ll explore diverse ways to automate the deletion of old files on Windows 10 and 11.


How to Automatically Delete Old Files on Windows 10 / 11 - Step-by-Step Guide


1. Use Storage Sense to Automatically Delete Old Files

Storage Sense is a built-in function in Windows 10 and 11 that facilitates your unfastened areas with the aid of mechanically deleting temporary documents, old files within the Recycle Bin, and different pointless facts. Here’s a way to set it up:


Steps to Enable Storage Sense:

Open Settings:

Press Win + I to open the Settings app.

Go to System > Storage:

In the Settings app, click on System and then pick Storage from the left-hand menu.

Turn on Storage Sense:

Under the Storage segment, toggle the transfer for Storage Sense to turn it on.

Configure Storage Sense Settings:

Click on Configure Storage Sense or run it now to customize its conduct.

You can set how regularly Storage Sense runs (e.g., each day, every week, or every month).

Choose how long files should remain in the Recycle Bin earlier than being deleted (e.g., 1 day, 14 days, 30 days, or by no means).

Decide how lengthy files in the Downloads folder have to be kept earlier than being deleted (e.g., 1 day, 14 days, 30 days, or never).

Run Storage Sense Manually (Optional):

If you need to unfasten up space right away, click the Clean Now button underneath the Storage Sense settings.

Storage Sense will now routinely delete antique and useless files based on your configured settings.


2. Use Task Scheduler to Delete Old Files

Task Scheduler is an effective tool in Windows that permits you to automate tasks, such as deleting old files. You can create a custom assignment to delete files older than a specific number of days from a particular folder.

Steps to Create a Task in Task Scheduler:

Open Task Scheduler:

Press Win + S, type Task Scheduler, and open the app.

Create a New Task:

In the Task Scheduler window, click on Create Task within the right-hand pane.

Name the Task:

Give your assignment a name, which includes “Delete Old Files.”

Set the Trigger:

Go to the Triggers tab and click New.

Choose how regularly you need the assignment to run e.g........, each day, weekly, or month-to-month).

Set the beginning date and time for the undertaking.

Set the Action:

Go to the Actions tab and click on New.

Set the motion to Start an application.

In the Program/script discipline, input cmd.Exe.

In the Add arguments subject, enter the subsequent command:


Replace C: PathToFolder with the course to the folder you need to smooth up, and -30 with the number of days (documents older than this variety of days can be deleted).

Save the Task:

Click OK to shop the assignment.

The undertaking will now run mechanically at the required durations and delete antique files from the designated folder.

3. Use PowerShell Scripts to Delete Old Files

PowerShell is an effective scripting device in Windows that allows you to automate complicated obligations. You can create a PowerShell script to delete old files and agenda it to run automatically.

Steps to Create a PowerShell Script:

Open Notepad:

Press Win + S, type Notepad and open the app.

Write the Script:

Copy and paste the following script into Notepad:

Replace C:\Path\To\Folder with the path to the folder you want to clean up, and 30 with the number of days (files older than this number of days will be deleted).

Save the Script:

Save the record with a .Ps1 extension, which includes DeleteOldFiles.Ps1.

Schedule the Script:

Open Task Scheduler and create a new task.

Set the movement to run the PowerShell script:

In the Program/script subject, input powershell.Exe.

In the Add arguments field, enter the route to your script, inclusive of:


Save the Task:

Click OK to store the task.

The PowerShell script will now run mechanically at the specified intervals and delete vintage documents.

4. Use Third-Party Tools to Automate File Deletion

If you decide on a greater person-pleasant answer, several 0.33-birthday party equipment allow you to mechanically delete old filesThis equipment frequently includes additional capabilities, inclusive of advanced filtering and scheduling options.

Popular Third-Party Tools:

CCleaner:

CCleaner is a famous machine optimization tool that consists of a feature to clean up vintage files. You can set it to automatically delete documents based on age and type.

BleachBit:

BleachBit is an open-supply tool that allows you to clean up pointless documents and unfasten up disk space. It consists of options to delete documents older than a designated wide variety of days.

CleanMyPC:

CleanMyPC is a comprehensive cleansing device that can automatically delete antique documents, transient files, and other junk facts.

5. Use Disk Cleanup to Remove Temporary Files

Disk Cleanup is a built-in software in Windows that enables you to take away transient files, device documents, and different pointless information. While it doesn’t automatically delete files, you could schedule it to run periodically with the use of Task Scheduler.

Steps to Schedule Disk Cleanup:

Open Task Scheduler:

Press Win + S, type Task Scheduler, and open the app.

Create a New Task:

Click on Create Task inside the right-hand pane.

Name the Task:

Give your undertaking a call, consisting of “Run Disk Cleanup.”

Set the Trigger:

Go to the Triggers tab and click New.

Choose how often you need the challenge to run (e.g., daily, weekly, or month-to-month).

Set the Action:

Go to the Actions tab and click on New.

Set the action to Start a program.

In the Program/script discipline, input cleanmgr.Exe.

In the Add arguments subject, input /sagerun:1.

Save the Task:

Click OK to save the challenge.

Disk Cleanup will now run automatically at the specified periods.

Conclusion

Automating the deletion of antique documents on Windows 10 and eleven is a top-notch way to hold your device strolling easily and free up valuable disk space. Whether you use integrated gear like Storage Sense and Task Scheduler, PowerShell scripts, or third-party third-party software, there’s a solution to fit your needs. By putting in place automatic document deletion, you may keep time and make sure your device stays muddle-loose. 

Post a Comment