SEARCH

The How-To Geek Forums Have Migrated to Discourse

How-To Geek Forums / Geek Stuff

I cant delete a folder in Dos

(7 posts)
  • Started 5 years ago by quahog
  • Latest reply from quahog
  • Topic Viewed 13143 times

quahog
quahog
Posts: 68

In my Dos prompt, I want to delete a whole folder and all its contents, and I saw on some site that if I use the rd or rmdir commands with the \s attribute it will delete a folder and all its contents, but when I do this, it sais that the folder does not exist and that the folder was not empty. Im messing around with batch files, and I keep running into this problem. Please help.

Thanks

Posted 5 years ago
Top
 
whs
whs
Posts: 17584

LH, Scott, our new friend seems to still have a few problems with the different Fora. I suggest to move this to "Geek stuff" to give it the proper attention.

Posted 5 years ago
Top
 
ScottW
ScottW
Posts: 6609

quahog, hey. From the syntax of rmdir, it does look like the /s switch should do the trick:

C:\>rmdir /?
Removes (deletes) a directory.

RMDIR [/Q] [drive:]path
RD [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S

You can also use the /q switch in batch files. The problems that you are seeing might have something to do with file attributes, such as hidden, system, and read-only. I don't know how rmdir will try to handle those attribs.

Posted 5 years ago
Top
 
ScottW
ScottW
Posts: 6609

Yes, as I suspected. From the command line reference at TechNet:
http://technet2.microsoft.com/.....x?mfr=true

It can't handle hidden or system files. Last I knew, there was no built-in command to do this, but you can get a small utility that will. I used to use one called treedel, but I don't know what the latest is.

Posted 5 years ago
Top
 
Scott
Scott
Posts: 5618

Oh and Quahog, you're on double not-so secret probation.
We can leave it at that, or you can protest and be banned yet again.

Posted 5 years ago
Top
 
quahog
quahog
Posts: 68

Do these commands work with batch files, cause thats what Im using them with, and also, I cant even delete a folder with dumb text files that I just made in it, I dont think theres any hidden, system, or read-only files.

Posted 5 years ago
Top
 
quahog
quahog
Posts: 68

Thanks for the help, but I figured out that my problem was when I put in the rd command, I was using the \ for the attributes and not the / which is what your supposed to use.

Posted 5 years ago
Top
 



Topic Closed

This topic has been closed to new replies.

Enter Your Email Here to Get Access for Free:

Go check your email!