Windows 10, is the sum up of a number of functionalities than its other versions. You must have observed that there is a number of files that do not undergo the modification or turn useless but still occupy space in your PC. In this way, they ruin the smooth workup of your PC.
There are lot many files that get add-on due to the daily work but becomes useless as the days pass on. Therefore, to get rid of such files, you can employ certain methods that will automatically delete the files older than X days (depends on days you opt) rather than to manually search files individually and then delete it.
The task of evacuating the older files can easily be achieved by using the command prompt and the task scheduler. Let’s check out the process using these two, how you can easily delete the older files automatically in Windows 10.
How to Delete Files Older Than X Days Automatically on Windows 10 Using ForFiles
- Firstly, open start.
- Look for ‘command prompt’. The outcome you get, right click on it and opt for ‘Run as administrator’.
- Now type the command, ForFiles /p “C:\path\to\folder” /s /d -30 /c “cmd /c del @file”; for the files that has not gone under modification in the past 30 days.
- Now press ‘enter’.
How to Delete Files Older Than X Days Automatically on Windows 10 Using Task Scheduler
- First of all, open start.
- Now look for the task scheduler and hit the topmost outcome.
- Now you’ll find the folder Task Scheduler Library.
- Therefore, right-click on Task scheduler library.
- Next, hit the option, ‘New Folder’.
- Create the folder name and hit ok.
- Now to the folder created, just right click on it and opt for ‘create task’.
- Now put on a name for the task in the ‘name box’.
- Now go to ‘General’ tab and beneath the ‘security options’, opt for ‘Run whether the user is logged on or not’.
- Next, clear up the option of ‘Do not store password’.
- Hit ‘Triggers’ tab. Then hit, ‘new’ button.
- From ‘Begin the task’, opt for ‘on a schedule’.
- Now under the ‘settings’, mention the time period for the workability of your task (daily, monthly, etc).
- As per your choice, frame out the start settings.
- Then click ‘ok’.
- Now click the ‘actions’ tab and hit ‘new’.
- From the drop-down menu of ‘Actions’, opt for ‘start a program’.
- Now you need to type a command, “ForFiles’’ in that of ‘program/script box’.
- Next, you need to type a command, /p “C:\path\to\folder” /s /d -30 /c “cmd /c del @file”; in the box of add arguments.
- Hit ‘ok’.
- Now hit ‘settings’.
- Next click on ‘ok’.
- Then put on the administrative username as well as the password, if prompted.
- Finally, hit ‘ok’.
After you are finished with the steps, your older files will get deleted as per your specified days. Make sure that the name of the folder should not be changed and also you do not move the location of your folder. If these things are not taken care then you could not achieve your task, thus it will fail.
We tried to project the process of deleting older files automatically in Windows 10 in the easiest way and hope that following the above-mentioned steps, you’ll be able to achieve the task. Hence, if you are such an aspirant, then try out the above-described steps and share your experience with us. Your views are very important to us.
Lori is the founder, author, & Sr. editor of Snaptube.vip. After graduating from the University of Houston, she indulged in full-time blogging and has been working as an Editor-in-chief for renowned publications – the Knoxville News Sentinel.