How to remove all folders of name x within a directory using cmd/batch file

后端 未结 4 597
忘了有多久
忘了有多久 2021-02-15 06:04

I have a folder named x with a number of subfolders and files. I want to delete a folder named y that is present in x and all of it\'s subfolders. The said folder that has to be

4条回答
  •  遥遥无期
    2021-02-15 06:26

    FOR /D /R %%X IN (fileprefix*) DO RD /S /Q "%%X"
    

    Take care of using that...

    for RD command:

    /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
    

    the FOR command is used to loop through a list of files or variables, the options are very easy to memorize, Directory only Recursively.

提交回复
热议问题