How To Delete Files by Date in Windows

Files age with time, and while we may feel everything is important, we keep them for sake of keeping it. In the end, we start running out of space. One of the easiest ways is to delete older files. This article will tell you how to delete files in Windows according to the date. Please ensure that you stay tuned till the end of this article since we’ll be discussing multiple methods.

Delete Files by Date in Windows

Why Delete Files By Date?

Deleting files by date can prove to be advantageous for you. In Windows, with the help of several tweaks and methods, you can set it to automatically delete files that haven’t been modified for the ‘N’ number of days. It can save a crucial amount of space on your computer since these are the files you probably don’t need anymore.

The list includes deleting files that were last modified on a specific date. It also allows you to filter files from a particular event or point of time, files that aren’t needed on your computer.

How To Delete Files by Date in Windows

In this section, we’ll discuss some tried and tested methods to delete files by date in Windows. It will include free software and methods that can be performed with Windows inbuilt tools.

  1. Using Windows Terminal
  2. Using Windows Task Scheduler
  3. Using Windows File Explorer
  4. Windows Search Feature

Make sure to keep a backup of all the files. It is possible you may accidentally delete files, and it will be tough to recover them.

1] Using Windows Terminal To Delete Files By Dates In Windows

Windows Terminal, Windows Powershell, or Command Prompt is the interface that allows you to run specific commands on your Windows computer. We can use the Windows terminal to instruct our computer to automatically delete files that haven’t been modified for a certain period. Here’s how to do it:

  • Open Windows Terminal with admin privileges. To do this, right-click the Start icon, then click on the Windows Terminal (Admin) option.
  • Now in the Windows Terminal, paste the following command:
ForFiles /p "folder path" /s /d -30 /c "cmd /c del /q @file”

In this command, you must replace “Folder Path” with the actual folder path from where you wish to delete the files. The folder path can be copied from the address bar in File Explorer. To edit the number of days from which you want to delete the last modified file, edit the “d -30″ part. If you wish to set it to 7 days, set it to “d -7”.

  • When you paste the command and hit enter, there will be no response from Windows Terminal. To check if the command worked, open the file explorer.

2]  Using Windows Task Scheduler To Delete Files By Date In Windows

Windows Task Scheduler is used to schedule any task on your Windows computer. With this utility, you can instruct your Windows computer to do almost anything. It includes running a task or script or making almost any changes to your Windows PC at a specific time or at fixed intervals. The only condition is that for Windows Task Scheduler to work, Windows PC should be in a powered-on state.

Here’s how to delete files by date in Windows using Windows Task Scheduler:

  • Open Windows Task Scheduler By searching for it in the Start menu.
  • Now, click on the Task Scheduler Library folder from the left pane in the Task Scheduler. Then click on the New Folder option in the extreme right pane. Creating a new folder in Task Scheduler
  • Name the folder anything you wish, and click OK.
  • Once you create the folder, open it by expanding the Task Scheduler Library folder.
  • When in the newly created folder, click on the Create Task option from the right pane.
  • Now, a new window will open. You have put a proper name in the Create Task window in the name field.
  • Now, scroll down to enable the Run whether the user is logged on or not. Also, untick the Do not store password option below. Creating a new task in task scheduler
  • Now, open the triggers tab, and create a new trigger. Set a schedule for your task and click OK to save it.Setting Scheule For a Task In Task Scheduler
  • Once saved, head to the Actions tab and create a new action.
  • In the Program/Script field, enter the following command:
ForFiles
  • In the Add Arguments field, paste the following command and save the action:
ForFiles /p "folder path" /s /d -30 /c "cmd /c del /q @file”

In this command, you must replace “Folder Path” with the actual folder path from where you wish to delete the files. The folder path can be copied from the address bar in File Explorer. To edit the number of days from which you wish to delete the last modified file, edit the “d -30″ part. If you wish to set it to 7 days, set it to “d -7”.

Creating a new action in task scheduler

  • Lastly, go to the settings, and make sure that the following options are enabled:
    • Allow task to be run on demand
    • Run task as soon as possible after a scheduled start is missed
    • If the task fails, restart every
  • Once done, the task will automatically run at the scheduled time and date and clean the old files for you.

3] Delete Files By Date Using Windows File Explorer

It is one of the easiest methods on the list. While you might need to do everything manually, this is a hassle-free method and does not want you to tweak crucial Windows components. Here’s how to delete files by date using Windows File Explorer:

  • Open the respective folder where you wish to delete the files in Windows Explorer.
  • Now, in the top bar, click on the Sort option. Now, hover over More.
  • In the more options, you’ll find the Date Created option. Select it.
  • Once selected, this will sort your files according to the created date. You will now see files categorized by Today, Earlier this week, Last Month, and Earlier This Year. Sort Files By Date Created In Windows Explorer
  • Click on the categorization option to select all files for a particular period and press the Delete option on your keyboard to delete the files.

Deleting files by dates using one of the methods we suggest will save you a lot of time as you now don’t need to nitpick every file created or modified on a specific date or during a specified period. We hope you found the article to be helpful. Please make sure you share it with everyone.

4] Deleting Files using Windows Search Feature

You can create search folders that keep you from repeating a search every day and are always fresh. You can even share these search folders with other users like any other folder in windows.

  • Launch Windows Explorer.
  • Navigate to the destination folder or drive where you want to search.
  • Use advance search query to search for what you are looking for.

Here we will take an example to delete files by date. You can use operators like date accessed, modified date, and created date as operators and combine them with sizes ranging from zero KB files to huge files.

Delete Files by date example in Windows

Once you save it as a search folder or do it when you want, it will list down all the files and folders, and you can delete them.

The disadvantage of this system is that you need to learn the operators, which is not very difficult, but if you are looking for straight options, the first application we discussed is best to use. However, learn the search operators as they are convenient when searching to find any file even if you are not planning to delete them. Learn to create search folders

Related: How to recover deleted files or Securely delete them permanently

How To Delete Files In Windows Without Sending Them To The Recycle Bin?

To Delete files in Windows without sending them to the recycle bin, all you need to do is click on the file to select it, then press Shift+Delete on your keyboard to delete the file permanently without sending it to the Recycle bin.

Is It Safe To Use Command Prompt To Tweak Windows?

It entirely depends on which command you use to tweak Windows. Using a command prompt is a complex process, and if you are not sure about being safe, you better not run it as it can cause your PC to break down in the worst cases.

LEAVE A REPLY

Please enter your comment!
Please enter your name here