Skip to content

How To Blog

how to

  • vat calculator trinidad

    we provide vat calculator trinidad for check your things and tax amount.The value added tax is 12.5 % . vat calculator trinidad [insert_php] include (“vat-calculator/index.php”);[/insert_php]

  • Buying Your Child’s First Smartphone? Here Are the Best Mobile Parental Controls

    Buying Your Child’s First Smartphone? Here Are the Best Mobile Parental Controls

  • Add Shortcuts to the Right-Click Context Menu in Ubuntu Linux Tips
  • How To Install Bleeding Edge iOS Features Early With Beta Profiles Tutorials
  • Create RAID-Like Data Backup using Storage Spaces on Windows 10 How-To
  • Best ti-84 plus c silver edition graphing calculator 2020

    Best ti-84 plus c silver edition graphing calculator 2020

  • A Streaming Service for Horror Fans Cool Websites
  • How to Completely Remove All Google Apps From Android How-To

How to Automatically Delete Files in Windows

Posted on October 6, 2020 By blog_786 No Comments on How to Automatically Delete Files in Windows

Earlier I wrote about the DropIt program, which automatically moves or copies files when new files appear inside a folder. This can be useful, for example, if you have limited local hard drive space and want to move all of your downloads to an external storage device.

If you want to delete files automatically, there are two ways you can do it in Windows. The first method involves downloading the free AutoDelete app that lets you set up a schedule to delete files in a specific folder. I’ve already written two detailed guides for using the program (here and here

The second way to delete files is to create a batch file and then schedule that batch file to run. All of this can be done without installing third-party software. In this article, I’ll walk you through how to create a batch file and then use the task scheduler to have the script run periodically.

Step 1 – Create a batch file

If creating a batch file sounds a little intimidating or too technical, don’t worry, because you don’t need to know what it means. I will explain what you need to copy and paste, where and what parameters you can change. First, open Notepad, copy and paste the following line of text:

forfiles -p “C: Test” -s -m *. * / D -5 / C “cmd / c del @path”

The line above probably doesn’t make sense and that’s perfectly fine as I’ll explain it below. Basically, it tells Windows to delete all files in the C: Test folder and subfolders older than 5 days. This is how your Notepad file should look like.

How to Automatically Delete Files in Windows

Before we get into more details about the command, let’s save the file and test it. First, create a folder on your computer called Test at the root of the C drive. Then click File – Save and save the file as a batch file. To do this, enter a name followed by .bat, and then change the Save as type drop-down menu to All Files.

How to Automatically Delete Files in Windows

Note that you can save the file anywhere on your hard drive, it doesn’t matter. Now create some dummy files in the Test folder and then double click the Delete.bat file to run it. Is anything being deleted? Probably not!

The reason nothing was deleted is because the command specified / D -5, which means files are older than 5 days. To delete any file no matter when it was created, you can either change -5 to -0, or you can delete the / D -5 part entirely. Now if you run it, all files will be deleted.

To customize the command, the first thing you can do is change the directory to something other than C: Test. It’s as easy as copying the path from Windows Explorer to the desired directory and pasting it into a command in Notepad.

How to Automatically Delete Files in Windows

Next comes the -s option that you see after the directory path. This means that the team must also go through all the subfolders. If you don’t want to remove files from subfolders, remove the -s parameter.

Next comes -m, followed by *. *, Which means the command must evaluate files of any type. If you only want to delete certain types of files in the folder, such as PDF files or JPG images, just change *. * To * .pdf or * .jpeg, and only these files will be deleted.

The / D -X part we already talked about in terms of how old the files need to be before they can be deleted. You can leave it with a value greater than 1, set it to 0, or remove it altogether. That’s all we need to know about the team.

There are several things to note when running this command. First, when files are deleted, they do not end up in the trash, but are deleted permanently, so be careful when using it. Second, the command only deletes files, not folders.

Since this is a batch file, you can also add multiple versions of this command to the same file. For example, here I am creating a batch file that will delete all DOCX files older than 180 days, all PDF files older than 60 days, and all TXT files regardless of the age of the files.

How to Automatically Delete Files in Windows

Step 2 – Schedule the batch file

Now that your batch file is created and saved, let’s go ahead and schedule it to run again. To do this, we need to open the task scheduler.

Luckily, I’ve already written an article on how to schedule a batch file, so open that page to get started. Scroll down to the “Schedule batch file on PC startup” section and follow the instructions.

How to Automatically Delete Files in Windows

The only thing you need to change is the trigger. You can choose from the following options: daily, weekly, monthly, at computer startup, at logon, or when a specific event is registered.

If you select something like “Weekly” or “Monthly” and click “Next”, a new screen will open where you can specify the exact time and days on which the script should run.

How to Automatically Delete Files in Windows

How to Automatically Delete Files in Windows

Hopefully this is a good solution for most people who need to perform simple automated file deletion tasks on their PCs. If you have any questions, do not hesitate to leave comments. Enjoy!

–

Software Reviews

Post navigation

Previous Post: How to Remove or Uninstall Java (JRE) on Windows and Mac
Next Post: How to Rip DVDs to Your Hard Drive in Windows and OS X

Related Posts

  • Best Comic Book Creator Software of 2019 Software Reviews
  • 17 Apps to Help College Students Do Better in School Software Reviews
  • How To Play MKV Files On Windows Media Player Software Reviews
  • Alternative Browsers You May Not Have Heard Of Before macOS
  • Otter – An AI-Powered Audio Transcription Service That Actually Works Software Reviews
  • 6 Free Game Development Tools to Make Your Own Games Software Reviews

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Apple Watch
  • Computer Tips
  • Cool Websites
  • Free Software Downloads
  • Gadgets
  • Gaming
  • General Software
  • Google Software/Tips
  • Hardware
  • How-To
  • iOS
  • iPad
  • iPhone
  • Linux Tips
  • macOS
  • MS Office Tips
  • Networking
  • Product Reviews
  • Reviews
  • Safari
  • Smart Home
  • Smartphones
  • Software Reviews
  • technology
  • text
  • Tutorials
  • Uncategorized
  • Urdu Books PDF
  • Web Site Tips
  • Windows
  • Windows 10
  • January 2023
  • December 2022
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • December 2019
  • July 2019
  • May 2019
  • April 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018

2021 Android ) Apple apps Best browser change Chrome Closing words Concluding remarks Download Error Facebook From Google Image Internet Keyboard Mac make Movies Music online Packaging phone? Photos Print Search Shortcuts sites Switch Time Tips Tricks turn using Video Videos Watch What With Word Working? your YouTube

  • What is a Deepfake and How Are They Made? Computer Tips
  • Black, White & Gray Hat Hacking Defined Featured Posts
  • How To Change The Default Font In Office Apps Office Tips
  • 7 Fun Hidden Google Games You Can Play for Free Google Software/Tips
  • Fix Blank Screen After Changing Computer Display Settings Computer Tips
  • How to Disable Night Shift for Certain Apps on Mac How-To
  • Best programmable calculator 2020

    Best programmable calculator 2020

  • The Best Chrome Extensions for Productivity Google Software/Tips

Copyright © 2023 How To Blog.

Powered by PressBook News WordPress theme

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}
Go to mobile version