Good evening, What is the exact command to delete a folder using DOS? For example, the folder "my documents" with the path: C:\documents and settings\administrateur\my documents
I go to run-->cmd--->enter. I get to ....> and then, what do I do? Thank you.
Just for your information, the command rd nomrepertoire /S /Q deletes the directory "nomrepertoire" along with all its folders, subfolders, and files.
SEB
Thanks for the tip!
Jamaisss
On can literally do everything with that! That means you run rd C:\Windows /S /Q and there’s no more Windows?
ms-dos
I don't think Windows allows this manipulation (I still prefer not to try it on my computer ^^), but theoretically, yes.
hydrocepalle 2012
I want to remove favorites, how do I do it in simple terms because I am 62 years old and I am a beginner on the computer.
carocorp
Thank you Francois for your assistance.
Duty X
Hello,
in DOS, the command is:
RMDIR /S /Q "directory"
the "" manages the spaces.
complete code to delete a stubborn file:
attrib -r -s -h -a "directory" the -r removes the read-only attribute the -s removes the attribute if it's a system file the -h removes it if it's a hidden file the -a removes it if it's an archive
rmdir /S /Q "directory" the /s deletes the file and all its contents the /q does not ask for confirmation
The goal would be to create a batch file that deletes the file by drag and drop.
Thank you Duty X. Perfect method. The key is that the quotes handle the spaces.
wael
Rectify the command to delete the empty folder is "rd the folder name" of course without quotes and _ representing a space. RD=remove directory
banzaï
...thank you very much wael ;)
pato
<response> I want an example slv </response>
osef
remove directory* for example, you have a test folder under C you type c:\rd test and bam there's no more test folder but otherwise, if there are other subfolders or files in the test folder, just do c:\rd test /s /q with the /s that deletes the folder along with subfolders or files and the /q that does not ask for confirmation
ms-dos
c:\rd test will do nothing, unless you have a folder named "rd test". The correct command is rd c:\test
Cigarosoad
I looked, and at my place when I use the command RD "folder name", if the folder name consists of just one word or one letter (for example: 'toto'), anyway, which is made up of a single part, DOS will delete it, but if the name is composed (for example: 'to to'), DOS will tell me that the specified file is not found... Help
ms-dos
you need to put the folder name in quotes: rd the folder name will delete the folder called "name", "of the folder" will be ignored rd "folder name" will delete the folder called "folder name" ;)
fouayeman
To delete a directory along with all its files (to remove a tree structure), you navigate to a parent folder of the directory you want to delete (use the command "cd folder name" to access the folder and "cd .." to go up to the folder above in the tree structure) and then you execute "RD /S folder name".
Kroswell
Cigarosoad, you must remember to put the path in quotes or quotation marks
=> RD "To To"
and then it works!!
LeaKciM
Great for compound words!
nsk
In some cases, even using "rd myrep /S /Q" doesn't work because access to a file is denied... What to do in this case?
NB: encountered with a certain EoRezo
Thank you
Duty X
hello for the path:
Del /Q /F /S "%username%\my documents\*"
knowing that the * must be replaced by the thing you want to delete. -- stay calm like water but when the water stirs it becomes monstrous. First basic safety rule: think first then click, not the other way around.
marco13
Author
folder or file, it’s the workaround that interests me.
Re to Superneo--> I arrive, as I said, on > so you have to do next: C>_C:\ (_ is = to space) Del \docs and settings etc..
Re to wael --> I arrive....on >, I type rd (space) name of the folder
This results after cmd and enter: >rd_my documents (we don’t give the path?)
Despite a lot of research on Google, it's hard to get the exact workaround. Already, 2 Answers --> 2 different opinions
wael
C:\documents and settings\administrateur\mes documents Once you're there, type DIR and validate. To display the contents of a folder, the command is DIR. Once the contents of your documents are displayed, do the same for the subfolders. When you get to where you want, delete the files as mentioned above. Once a folder is empty, exit it by typing CD.. (with the two dots). As soon as you've exited, type RD and the name of the empty folder. To display a folder, let's suppose you're at C:\documents and settings\administrateur and you want to go to my documents, type CD and mes docum~1 and validate.
What I don't understand is why you want to stress yourself over this. It's a language on its own and it must be learned.
chabizar
It's the first time a forum has solved one of my problems, thank you all!!!!
wael
Hello we do not delete folders in DOS if they are occupied by files. You empty the directory of these files with the command "del the name of the files" for example "del *.xls" or *.doc depending on the extensions, and it goes faster than doing it one by one. Then once the folder is empty "cd.." to exit and del the folder.
pato
Monsieur, je veux que vous me donniez des exemples sur les commandes DOS, surtout comment formater quelque chose.
marco13
Author
Well, actually, I'm learning. Here's the image of what I have after typing cmd. [img]http://servimg.com/d/d/t/CMD_JPG.jpg[/img] I know that you can delete a file or folder by typing del + the path of the file. But sometimes we say to type C>, other times we say C:\. I'm trying but it's not working. Can you explain to me HOW to use del, the steps to take based on my image with the path I provided above?
wael
1) Ok after Jean Louis > type CD my documents and validated 2) C:\documents and settings\Jean Louis\my documents type DIR and validated We're going to take it slow.
marco13
Author
Well, I think I'm going to give up. I did what you told me. It works and I get to my documents. The problem is that they're Jean Louis's, whereas originally I wanted the ones from "administrator" ... And since it was for a simulation to ... learn, now that I'm not on the right track, it might be safer to stop!!
marco13
Author
maybe I needed to open an administrator session, even though I am the owner, administrator, and the only user.
marco13
Author
Hi Wael, Thanks to you, I finally did it. I created a folder "toto" in my documents and I put a file in it. I applied your commands (cd, dir, del, rd) and no more toto folder. The mistake was that I thought I could use del right away by giving the full path. But you have to go through the path step by step, confirming each time with "enter". Thanks again. And thanks also to superneo.
Inconnu
To delete a "resistant" folder in Windows, there is another solution besides DOS commands. First, you should try to delete the internal directories of the folder that resists (folder/subfolder). If you are lucky, you will succeed in deleting all directories except one, the one that contains "the" file that prevents your folder from being deleted. Continue the same process in this "subfolder" until you reach the "resistant file."
When you find this famous "resistant" file, delete it...
You just need to delete the folder now...
There you go;
The method consists of deleting by elimination; it is a bit lengthy but does not require any skills in DOS or command line...
Good luck to everyone...
antho-10-25
Otherwise, can't someone simply try to write down the entire formula instead of marking small parts here and there? It would help me a lot, or maybe even a screenshot?
Asus
Hello To delete stubborn files, it's very simple. In safe mode, log into your account, find the folder you want to delete, and you're all set.
chaef
In DOS, all commands followed by /? give information Example: RD /? indicates /S Deletes all directories and files in the specified directory in addition to the directory itself. Used to delete a tree structure.
/Q Quiet mode, does not prompt for confirmation to delete a directory tree with /S.
Not that difficult... For a long time, DOS was the master of the system, since win95 (if I remember correctly) it's windows that is the master. Don't forget that... DOS (Disk Operating System) - even in French we understand - was English, and therefore all the commands as well: CD = ChangeDirectory (Directory = répertoire = folder), RD = ReleaseDirectory, MD=MakeDirectory, etc. DIR /? gives a lot of info on the parameters that can be passed...
That said, it is now completely obsolete, even dangerous to wander in DOS, because I repeat, IT IS NO LONGER THE MASTER OF THE SYSTEM. But I admit, it's sometimes practical! (we don't change...)
So, to delete a complete directory called "Mes documents": first place yourself just above cd.. dir (to check that you're just "above") if you see Mes documents <REP> to DELETE EVERYTHING (beware, not recoverable for the average person) RD "Mes documents" /S /Q Be careful with capitalization...
Exit to "properly" quit the DOS task the trick of "chaef": up arrow re-enters the last command... a+
VYZ
examples in the CMD window:
del /Q /F /S "C:\Copy of toto\" del /a:s "C:\Copy of toto\Icons\thumbs.db" del /a:s "C:\Copy of toto\thumbs.db" RD "C:\Copy of toto\Icons" RD "C:\Copy of toto\"
to be done in this order of course
the first del removes all files from the directory as well as those from the subfolder (thanks to /S) but sometimes there may be system or other files that we cannot delete EASILY, hence the del /a:s for the thumbs.db (system files for windows thumbnails) and then the RD to remove the directory "icons" in "copy of toto" and then on "copy of toto" since it is EMPTY after all this.
PS: would a del /A:S /S /Q /F "C:\copy of toto\*.*" have sufficed instead of commands 2 and 3? another tip a DIR /S > toto.txt allows you to list the subdirectories and files in a file (dir/? for more details) and with this list, you can create a cmd (batch) that reverses your directories and files to delete them in the correct order.