• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

Deleteing Empty subfolders with a Batch File

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
Joseph Moody
Asked:
Joseph Moody
1 Solution
 
edster9999Commented:
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
 
Joseph MoodyBlogger and wearer of all hats.Author Commented:
Thanks! I learn something new everyday!
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now