How to Delete Batch Files of a Folder but Not Subfolders

It's pretty much everything in the title, really. I do have a 'root' folder with a lot of documents in it, and I want to empty it every evening, but I don't wish to destroy the subfolders it contains.

Best Answered by

Dany· Answered on Mar 09, 2023

Although it's not difficult to create a folder and subfolders, you definitely don't want to do so until you really have to if you already have a complicated directory structure that took effort to design. You can fairly quickly replicate a folder structure while ignoring the files within, but you may also choose to remove all the files from a folder while keeping the subfolder structure you've built. You are free to choose between the two approaches. This guide will show you how to use straightforward CMD command lines to remove files while keeping directories.

Unless you're deleting data from the root of the C disk, you don't require administrator access for this. You need to boot Command Prompt Windows 10 and type in del *.* /s /q. It is a simple command, isn't it? All files in this folder will be deleted, and subfolders within it will be contained by this command. Make sure you first make a backup of the files because the delete operation does not send the contents to the Recycle bin.

If you accidentally deleted some critical files and you cannot find them in the Recycle bin, here is a perfect tool that can help you a lot – EaseUS Data Recovery Wizard. Personal photos, favorite films, music, and videos can quickly be recovered with this safe tool. There are only three simple steps to retrieve the deleted files from your PC or laptop: scan the target disk/partition, filter and select the files, and recover the files.

Use EaseUS Data Recovery Wizard to recover deleted or lost files easily and quickly.

Tutorials on how to recover lost, deleted, or formatted data from HDD, SSD, USB, SD card, or other storage media on Windows and Mac.

People Also Ask

How to Delete Files on a Particular Date with Unix

If you have a list of files but only want to delete files older than a particular date with Unix. This post teaches you the specific command line to run a helpful script. You can also protect your data security with the help of EaseUS Data Recovery Wizard.

Dany

Feb 22, 2023

How to Delete Hacker Files to Free Up Space on Windows

Virus attacks and malware may cause chaos on your computer, and you may not be able to delete some files. We will help you remove the files with CMD and show you how to format the hard drive.

Dany

Feb 22, 2023

Is It Impossible to Completely Delete Files from the Computer

When you delete a file from your computer, it does not simply vanish - at least not immediately. The data may be recoverable. This guide will show you how to permanently delete files so they cannot be recovered in Windows 11/10/8/7.

Dany

Mar 10, 2023

How to Delete Files Across a Domain Remotely

You can configure a shortcut item to solve this problem. Using the Shortcut preference settings, you can configure a shortcut to a file system object. Before you build a Shortcut preference item, you should examine the behavior of each sort of action that this extension supports.

Dany

Mar 10, 2023

Accidentally Deleted Large MKV File, How to Recover

MKV videos that have been lost or destroyed can be recovered using the third-party best video recovery software. We will introduce the best solution to assist you in recovering deleted MKV videos using powerful Video recovery software - EaseUS Data Recovery Wizard in the following article.

Dany

Feb 22, 2023

How to Recover Deleted Files from Memory Card Using CMD

The command to recover deleted files from a memory card, USB stick, pen drive, and external HDD includes the attrib command and the dos command. This tutorial allows average and advanced users to recover deleted files from memory cards using cmd.

Dany

Mar 10, 2023