Deleting a directory structure without deleting the name of the root


  1. Posts : 106
    Windows 7
       #1

    Deleting a directory structure without deleting the name of the root


    HI

    With the command prompt of Windows 7 SP1, how do I delete a directory structure with their files without deleting the name of the root directory?

    THANKS

    BYE
      My Computer


  2. Posts : 9,582
    Windows 8.1 Pro RTM x64
       #2

    So you want to delete the contents of a folder without deleting the folder itself? Would that also include sub-folders within that folder?

    Simply enter cd <path to directory> at the prompt to make the required directory the target of the next command. Then, after verification that this is the correct directory and that you do indeed want to remove its contents, enter del *.* at the prompt. This should delete its contents, but not the directory itself. Please note that content cannot be easily recovered, which is why I asked you to verify the location first.
      My Computer


  3. Posts : 983
    7 x64
       #3

    Open Win Explorer, highlight the directory in the left hand side, Which will display all sub-folder and files on the right hand side, select all on the right, Press the Delete Key.

    Why fool with the CMD Prompt when it is so easily done in Explorer.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:32.
Find Us