Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help!!! How Do I Delete All folder From A Directory  (Read 2766 times)

0 Members and 1 Guest are viewing this topic.

kordi

    Topic Starter


    Starter

    Help!!! How Do I Delete All folder From A Directory
    « on: October 14, 2008, 02:42:37 PM »
    I have a problem deleting all folders in a directory.The only way i found is to use  rd /s [Name Of Folder],but i want to delete all folders at once... I tried rd /s *.* & rd /s * but that  did not worked.The same with del command.   :P Sorry For My Bad English  :P  Waiting for your help...Ty

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Help!!! How Do I Delete All folder From A Directory
    « Reply #1 on: October 15, 2008, 04:49:28 AM »
    Code: [Select]
    rd /s [Name Of Folder]

    That is the correct format to use. Specifically what did you use for name of folder?

    Quote
    but i want to delete all folders at once

    What result did you get?

    Note: Expect incorrect results if you're logged-in to any directory within the named folder tree structure.

     8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    kordi

      Topic Starter


      Starter

      Re: Help!!! How Do I Delete All folder From A Directory
      « Reply #2 on: October 15, 2008, 09:13:40 AM »
      First of all i want to thank you,for replying in my post.Now if  i have a folder named Folder1  i  write rd /s Folder1.With this way i delete the folder and all the subfolders contains in it.My problem is  if i have in a folder other 10 folders.How can i delete these 10 folders all at once???(I don't want to delete the first folder,i want to enter to first folder and then delete everything that is in it. Waiting....

      kordi

        Topic Starter


        Starter

        Re: Help!!! How Do I Delete All folder From A Directory
        « Reply #3 on: October 15, 2008, 09:22:41 AM »
        In order to give you understand i'll give you an other example.If i want to delete all the files a folder contains i write del /q *.*  .Now with rd what should i write instead of *.*????

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: Help!!! How Do I Delete All folder From A Directory
        « Reply #4 on: October 15, 2008, 12:33:14 PM »
        Quote
        I don't want to delete the first folder,i want to enter to first folder and then delete everything that is in it

        That was an important piece of information.

        Code: [Select]
        @echo off
        for /f "tokens=* delims=*" %%i in ('dir /s /b /a-d folder1') do (
        del /f %%i
        )
        for /f "tokens=* delims=*" %%i in ('dir /s /b /ad folder1') do (
        rd /s /q %%i
        )
           
        Note: You should use a fully qualified path to folder1. The code is written as a batch file to be run from the command prompt.
           
        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein

        kordi

          Topic Starter


          Starter

          Re: Help!!! How Do I Delete All folder From A Directory
          « Reply #5 on: October 15, 2008, 03:06:41 PM »
          I will look for what this loop does.Now i can't understand exactly.I will look for it and you will have my reply if i accomplished it.