Search code examples
windowsbatch-filenant

nant delete subfolders exclude files


need help regarding delete task in nant or command which can be used in nant build file.

here is the requirement, i have multiple files and folders in a root folder. i need to delete only folders but not files..

Any idea how to do this.

Blockquote

EX : ROOT
          -a.txt
          -b.txt
          -Folder1
          -Folder2

after deletion, it should be

Blockquote

EX: ROOT-
        -a.txt
        -b.txt

Thanks in advance.


Solution

  • used the above suggustions and found it out :

    Code :

    <echo file="CleanFolders.bat">for /d %%a in ("${dir}\subdir\*") do rmdir /s /q "%%~fa</echo>
        <exec program="CleanFolders.bat"/>