Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Batch File to remove unwanted folder

18 Aug 2016   #11

Windows 7 Ultimate 64Bit

The file that downloads is not a link or shortcut, it's an identical file.

My System SpecsSystem Spec
18 Aug 2016   #12

Windows 7 Ultimate 64Bit

Ok, tell me this, I created a batch file. Here it is:
Forfiles -p "E:\Completed" -s -m *.* /C "cmd /c del @path"

I placed a txt, MP4, MP3, avi, mkv & mov file in the "E:/Completed" folder, initiated the batch file and it removed ALL files.
I then placed the same files in E:/Completed/TEST. Initiated the batch file, it deleted ALL files in "TEST" folder but left the "TEST" folder.

All I would like the batch file to do is to remove ALL folders and files.
My System SpecsSystem Spec
18 Aug 2016   #13

Windows 7 Ultimate 64Bit


If anyone is looking to delete every single file and subfolder in a directory,
but not the directory itself, here is the batch file to do so.

FOR /D %%p IN ("E:\Completed\*.*") DO rmdir "%%p" /s /q

Your welcome :)
My System SpecsSystem Spec


 Batch File to remove unwanted folder

Thread Tools

Similar help and support threads
Thread Forum
Add batch file to the Start folder? (hide Safely Remove Hardware icon)
I have finally found a way to get rid of the annoying Safely Remove Hardware icon in the Task Tray that consistently works on my little computer. It is this batch file: from:...
General Discussion
.bat batch move file to folder based on filename + remove string
I have a folder with thousands of filenames like this. I need to put them inside folders and remove the useless parts from the filenames. I need to do this before adding the files inside my XBMC library. ] Some.File.Name.With.A.Very.Long.String.avi ...
General Discussion
I need a batch file to open a random file within a certain folder/path
I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'. I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands,...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
batch file open file for program in the startup folder
I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:29.
Twitter Facebook Google+