Solved

Deleteing Empty subfolders with a Batch File

Posted on 2008-10-21
2
420 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 21

Author Closing Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now