
Type the following command to delete files on Windows 10 that haven’t been modified in the last 30 days and press Enter: ForFiles /p "C:\path\to\folder" /s /d -30 /c "cmd /c del /q the command, change "C:\path\to\folder" specifying the path to the folder you want to delete files and change /d -30 to select files with a last modified date. Search for Command Prompt, right-click the result and select the Run as administrator option. To use the ForFiles command to delete files older than a certain number of days on Windows 10, use these steps: If you have different folders with many files and would like to clean up by deleting those older than a certain number of days, you can use the ForFiles command. Delete files older than X days automatically using PowerShellĭelete files older than X days using ForFiles on Windows 10.Delete files older than X days automatically using Task Scheduler on Windows 10.Delete files older than X days using ForFiles on Windows 10.Important: Before using the command on the folder you want to organize, it is recommended to test these steps using a test folder, as using the incorrect parameters and other mistakes can cause the deletion of the wrong files. In this guide, you will learn the steps to manually delete files that haven’t been modified in a specific number of days and the instructions to create an automated task that will delete files older than a certain number of days inside any folder on Windows 10. When you store temporary files from the internet or projects in different folders, it’s possible to use the ForFiles command in Command Prompt and Task Scheduler to delete files from any folder older than a specific number of days. However, it is limited and doesn’t offer an option to monitor additional folders to delete files that haven’t changed in the previous 60 days.

Alongside the ability to delete temporary files, you can also enable the feature to delete files in the recycle bin or Downloads folder that haven’t changed in the last 30 days. The Settings app includes Storage sense, a feature that automatically runs when the storage is low in space.


On Windows 10, you can use Command Prompt and Task Scheduler to automatically delete files older than a certain number of days to free up space and keep your files organized.
