The Downloads folder in Windows 10/11 is a default location where files that are downloaded from the internet are stored. This folder can quickly become cluttered with unnecessary files that take up valuable disk space. Keeping a tidy Downloads folder can help to optimize the performance of your computer and make it easier to find important files. In this article, we will show you how to automatically delete files in the Downloads folder in Windows 10/11.
Method 1: Using Windows 10/11 built-in storage sense feature
Windows 10/11 has a built-in storage sense feature that automatically frees up disk space by deleting temporary files, files in the Recycle Bin, and files in the Downloads folder that haven't been modified in the last 30 days. To enable this feature, follow these steps:
Step 1: Open the Settings app by pressing the Windows key + I on your keyboard or by clicking on the Start menu and selecting Settings.
Step 2: Click on System.
Step 3: Click on Storage.
Step 4: Turn on the toggle switch next to Storage sense.
Step 5: Click on the Configure Storage Sense or run it now link.
Step 6: Under the Temporary files section, select the number of days after which files in the Downloads folder should be deleted.
Step 7: Turn on the toggle switch next to Delete files in my Downloads folder that haven't changed for over X days.
Step 8: Click on the Clean now button to run Storage Sense and delete the files in your Downloads folder.
Method 2: Using a batch file
Another way to automatically delete files in the Downloads folder is by using a batch file. A batch file is a script that contains a series of commands that are executed in order when the file is run. In this case, we will create a batch file that will delete all files in the Downloads folder that are older than a certain number of days.
Step 1: Open Notepad.
Step 2: Type the following command in Notepad:
forfiles /p "C:Users<Username>Downloads" /s /m *.* /d -<NumberOfDays> /c "cmd /c del @path"
Replace <Username> with your Windows username and <NumberOfDays> with the number of days after which files should be deleted. For example, if you want to delete files that are older than 30 days, the command should look like this:
forfiles /p "C:Users<Username>Downloads" /s /m *.* /d -30 /c "cmd /c del @path"
Step 3: Click on File and select Save As.
Step 4: In the Save As dialog box, select a location to save the batch file.
Step 5: In the File name field, enter a name for the batch file, followed by the .bat file extension. For example, if you want to name the file "DeleteDownloads," the file name should be "DeleteDownloads.bat".
Step 6: Click on Save.
Step 7: To run the batch file, double-click on the file in Windows Explorer.
Method 3: Using a third-party app
There are several third-party apps available that can automatically delete files in the Downloads folder. One such app is CCleaner. CCleaner is a free system optimization and privacy tool that can be used to clean up your computer and delete unwanted files. To use CCleaner to automatically delete files in the Downloads folder, follow these steps:
Step 1: Download and install CCleaner.
Step 2: Open CCleaner.
Step 3: Click on the Options tab.
Step 4: Click on the Settings sub-tab.
Step 5: Click on the checkbox next to "Run CCleaner when the computer starts."
Step 6: Click on the Smart Cleaning sub-tab.
Step 7: Turn on the toggle switch next to "Enable Smart Cleaning."
Step 8: Click on the Configure Smart Cleaning button.
Step 9: Under the Downloads section, turn on the toggle switch next to "Delete files in the Downloads folder that haven't been accessed for over X days."
Step 10: Set the number of days after which files should be deleted.
Step 11: Click on OK to save the settings.
Step 12: CCleaner will now automatically delete files in the Downloads folder based on the settings you have configured.
Method 4: Using a PowerShell script
PowerShell is a powerful command-line shell and scripting language that is built into Windows 10/11. You can use PowerShell to write a script that will automatically delete files in the Downloads folder. Here's how:
Step 1: Open Notepad.
Step 2: Type the following command in Notepad:
Get-ChildItem -Path "C:Users<Username>Downloads" -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-<NumberOfDays>)} | Remove-Item -Force
Replace <Username> with your Windows username and <NumberOfDays> with the number of days after which files should be deleted. For example, if you want to delete files that are older than 30 days, the command should look like this:
Get-ChildItem -Path "C:Users<Username>Downloads" -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item -Force
Step 3: Click on File and select Save As.
Step 4: In the Save As dialog box, select a location to save the PowerShell script.
Step 5: In the File name field, enter a name for the script, followed by the .ps1 file extension. For example, if you want to name the script "DeleteDownloads," the file name should be "DeleteDownloads.ps1".
Step 6: Click on Save.
Step 7: To run the PowerShell script, open PowerShell by pressing the Windows key + X on your keyboard and selecting Windows PowerShell (Admin) from the menu.
Step 8: Type the following command in PowerShell and press Enter:
Set-ExecutionPolicy RemoteSigned
Step 9: Type the following command in PowerShell and press Enter:
.DeleteDownloads.ps1
The PowerShell script will now automatically delete files in the Downloads folder based on the settings you have configured.
Conclusion
Keeping a tidy Downloads folder is important for maintaining the performance of your computer and optimizing disk space. In this article, we have shown you four different methods for automatically deleting files in the Downloads folder in Windows 10/11. Whether you prefer to use built-in features or third-party apps, there is a method for everyone. By using one of these methods, you can easily keep your Downloads folder clean and clutter-free.