How to delete a folder using DOS command

Anybody can give me a step by step DOS command to delete a folder Name 1    in C drive
Who is Participating?
TribusConnect With a Mentor Commented:
"rd" and "deltree" also are good commands


rd dirname /q /s
deltree dirname

rd and rmdir without the /s will not work if there are files or other objects in the directory. The /q is to run in quiet mode while using /s

deltree is the "correct" way to delete directories that contain files or other objects.  Use /y with deltree to suppress the confirmation prompt.

The exact command for what you are asking for in the question with deltree is:

deltree c:\1 /y

Open in new window

You may need to run your DOS box as administrator in some cases.
Rikin ShahConnect With a Mentor Microsoft Dynamics CRM ConsultantCommented:

Use this command-
rmdir c:\1 /s
Steve KnightConnect With a Mentor IT ConsultancyCommented:
Unless you are actually using DOS or very old OS DELTREE is not the right way.

If this is command prompt in XP, Windows 7 etc. then rmdir (or short of same command rd) is right as with the first post.  be careful of course, I don''t suggest CD into a folder then RD as if the CD fails because the dir doeesnt exist it would remove your current dir.

you may also want to add the /q prompt to supress the question.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

TribusConnect With a Mentor Commented:
The OP never mentioned Windows at all in the post/tags, so I answered with strict DOS thinking...or did I show my age...
Steve KnightConnect With a Mentor IT ConsultancyCommented:
Fair enough.... the picture is a Office 2007+ screen shot of a Windows 64 bit machine though :-)

(Oh and DOS was new fangled when I started using it, nothing useful like a DELTREE command to start with...)
kianhowAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.