To use the ForFiles command to delete files older than a certain number of days, use these steps: If you have different folders with a lot of files and you would like to cleanup by deleting those files that are older than certain number of days, then you can use the ForFiles command.
How to use ForFiles to delete files older than X days on Windows 10
How to use ForFiles to delete files older than X days on Windows 10.Important: Before using the command on the folder you want to organize, it’s recommended to test these steps using a test folder, as using the incorrect parameters and other mistakes can cause deletion of the wrong files. In this guide, you’ll learn the steps to manually delete files that haven’t been modified in a specific number of days, and the steps to create an automated task that will delete files older than a certain number of days inside any folder on Windows 10. If 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, the feature is limited and doesn’t offer an option to monitor additional folders to delete their files that haven’t changed in the last 60 days. Alongside the ability to delete temporary files, you can also enable the feature to delete files that have been 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 runs automatically when running low on storage to free up 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.