/Make windows automatically delete old files in your Downloads Folder

Make windows automatically delete old files in your Downloads Folder

Over time we clutter up our computer with tons of files downloaded over the internet from our browser be it meme files, important documents, one time installers, etc. 

With SSD prices still relatively high compared to HDD counter parts, leaving out old files sitting in our downloads folder unused for months or worse years could end up hurting our SSD’s performance in the long run because we end up running out of storage.  Here’s a quick and simple way to avoid that by making windows automatically delete old files in your downloads folder.

Buckle up folks, this is a two minute job (at most).

Create a batch file.   A batch file is simply a script that’s saved on to a disk.  We’ll use this as a starting point.

REM Remove files older than 30 days
forfiles /p "C:\Users\YOURUSERNAME\Downloads" /s /m *.* /c "cmd /c Del @path" /d -30


You can adjust it as needed:

  • C:\Users\YOURUSERNAME\Downloads – the directory you want to keep clean
  • 30 – age of file in number of days
Save as a bat file. Make sure you select All files in Save as type otherwise you’ll end up with a text file instead
Search for Task Scheduler on the start menu and open it
Select Action then Create Task
Populate the Name and Description and click Next
Set the trigger to Weekly and click Next
Choose a schedule, I want it to run on a Sunday at 9 am. Click Next afterwards
Start a program is already selected by default so just click Next
Look for the bat file you created earlier. Select it and click Open
This screen just confirms out selection. You can add arguments to the bat file but that’s for more advanced users. For our use case, just click Next
This screen summarizes our settings. Once you’re sure it’s correct, hit Finish

And that’s it.  The task won’t run immediately since you set it on a schedule but when it does, you can see that the folder you selected will be cleared out of old files.  Pretty neat huh?