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

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
Screen.docx
0
kianhow
Asked:
kianhow
5 Solutions
 
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

Use this command-
rmdir c:\1 /s
0
 
TribusCommented:
"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
 
Steve KnightIT 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.
steve
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
TribusCommented:
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
 
Steve KnightIT 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...)
0
 
kianhowAuthor Commented:
bb
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

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