How to delete an empty directory (or the directory with all contents recursively) in gradle?

前端 未结 6 1418
后悔当初
后悔当初 2020-12-15 18:10

I can\'t figure out how to delete all contents of a directory.

For cleaning out a directory, I want to remove all files and directories inside it: I want to wipe ev

6条回答
  •  时光说笑
    2020-12-15 19:00

    Groovy enhances the File class with several methods. You can delete a directory with all it's subdirectories and files using deleteDir() method.

    task deletebin << {
        def binDir = new File('bin')
        binDir.deleteDir()
    }
    

提交回复
热议问题