Solved

Deleteing Empty subfolders with a Batch File

Posted on 2008-10-21
2
431 Views
Last Modified: 2010-04-21
Is there a simple way to use a batch file to delete an empty subfolder? I can delete all of the contents within a folder but I can't seem to delete the leftover empty folder.
0
Comment
Question by:Joseph Moody
2 Comments
 
LVL 20

Accepted Solution

by:
edster9999 earned 500 total points
ID: 22770792
There used to be a nice command in DOS called deltree
But it was removed a few years ago.

the code was put into rmdir
if you use the /s and /q

This will then delete a full directory and all its contents and then the directory itself.

You might need to put double quotes round the dir name or the variable you are using if the directory name (or parent ones) have spaces in them.
0
 
LVL 22

Author Closing Comment

by:Joseph Moody
ID: 31508466
Thanks! I learn something new everyday!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question