If you are using Windows 11 and are looking for a way to delete files in bulk by specific time frames, such as files older than 10, 15, 8, 9 days, etc. This article will show you how to run a specific command that will allow you to target a location on your computer and delete everything older than your specified time frame.

Related: How to fix no featured app section in Microsoft Store.

Windows operating systems have a lot of features and options that people don’t use frequently because of their scary-looking nature. Anything that requires the use of the Command Prompt or PowerShell tools is usually overlooked as a viable option for most users. As a result, a lot of powerful and handy options don’t get utilized enough. A classic example of this is the bulk delete by date command which allows you to delete files from locations that are older than a user-specified date (in days).

This means that you can open the Command Prompt tool on Windows 11 and run a single command that will automatically find and delete all the files that are older than a specified amount of days from a specific folder. Although it may sound and look a little complicated it’s super easy so follow along as we guide you through the process. You can even do a test run if you like. Just create a new folder and put some content in it and run the command to that location.

How do you delete files in bulk that are older than a certain amount of days on Windows 11?

If you aren’t all that confident with Command Prompt we advise you to make a practice folder for this process. Just make a new folder and place some files in it then target that folder in the command this article will show you.

  • Open Start on Windows 11.
  • Search for Command Prompt, right-click the result and select the Run as administrator option.
  • Type the following command to delete files that haven’t been modified in the last 30 days and press Enter:

Example command

ForFiles /p "C:\PATH\TO\FOLDER" /s /d -30 /c "cmd /c del /q @file"

Edited example command

ForFiles /p "C:\Users\Jasch\Downloads\TEST BULK DELETE FOLDER" /s /d -5 /c "cmd /c del /q @file"

  • When you use this command replace C:\PATH\TO\FOLDER with the location of the folder you want to delete content from. The best way to find this address is to go to the location and copy the address from the File Explorer address bar. Finally, change d -30 to the number of days you want to go back for example d -5.

How to bulk delete files by date on Windows 11

  • Now you can press Enter and the command will run and remove content that hasn’t been modified within that amount of time.
  • In the above command remember to change "C:\PATH\TO\FOLDER" specifying the path to the folder, you want to delete files and change /d -30 to select files with the last modified date.

For the people that would like to know a little more about the command-line components below is a breakdown of what each segment does.

  • /p — Is the pathname for where to start searching.
  • /s — Tells ForFiles to search inside subdirectories.
  • /d — Sets the last modified date for a file.
  • /c — Tells ForFiles to execute the command (Must be wrapped in double quotes.) The default is “cmd /c del @file”.
  • /q — allows deleting folders without requiring a confirmation prompt.