Solved

How to delete a folder using DOS command

Posted on 2013-06-29
6
841 Views
Last Modified: 2013-06-30
Anybody can give me a step by step DOS command to delete a folder Name 1    in C drive
Screen.docx
0
Comment
Question by:kianhow
6 Comments
 
LVL 19

Assisted Solution

by:Rikin Shah
Rikin Shah earned 300 total points
Comment Utility
Hi,

Use this command-
rmdir c:\1 /s
0
 
LVL 14

Accepted Solution

by:
Tribus earned 100 total points
Comment Utility
"rd" and "deltree" also are good commands

Use:

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.
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 100 total points
Comment Utility
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.
steve
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 14

Assisted Solution

by:Tribus
Tribus earned 100 total points
Comment Utility
The OP never mentioned Windows at all in the post/tags, so I answered with strict DOS thinking...or did I show my age...
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 100 total points
Comment Utility
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...)
0
 

Author Closing Comment

by:kianhow
Comment Utility
bb
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
asp.net mvc5 3 35
Is IHttpActionResult a promise pattern? 2 33
Refresh Datagridview from another form 1 25
Data Saving 5 24
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
If your app took Google’s lash recently, here are the 5 most likely reasons.
This video demonstrates basic masking and how to edit the mask to reveal the desired image.
This video shows how use content aware, what it’s used for, and when to use it over other tools.

743 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

22 Experts available now in Live!

Get 1:1 Help Now