Question Locked

Command prompt

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Dear all,
How to delete the sub folder from the folder itself from the command prompt?

7 replies

by churdoo

What O/S? Is the subfolder empty?

In DOS/Windows O/S and I think *IX too, and if the subfolder is empty: rd foldername or rmdir foldername (remove directory)
Some versions of DOS/Windows, subfolder not necessarily empty: deltree foldername (be very careful with this command, though this command is not in the CMD prompt of Vista or XP, possible others).

by rzwoo

The subfolder is not empty. I have try use rd and rmdir, this not work well because it delete the origin folder as well. Im actually wish to keep the folder itself.

by bizintelligence

I create a folder update in c:\temp and copied some file into it.

Later I just did following:

c:\>cd c:\temp
c:\temp> rmdir /S update

it deleted folder update and its files.

Is that what you wanted?

Cheers !

by rob miners

If you are constantly deleting this same folder you can copy the line below into Notepad, then modify it to suit and save it as a Batch file. EG: delfol.cmd or delfol.bat and run it whenever necessary.

echo y| rd c:\temp\temp /s

From the command line just type: rd c:\temp\temp /s and press Y when asked.

by rzwoo

I try this already

Del /f /s /q d:\Temp
rd /s /q d:\GPI\Temp
md d:\GPI\Temp

This discussion is closed to new replies.