Java.nio: most concise recursive directory delete

前端 未结 6 880
日久生厌
日久生厌 2020-12-13 06:10

I am currently trying to recursively delete a directory... Strangely enough the shortest piece of code I was able to find is the following construct, employing an ad-hoc

6条回答
  •  鱼传尺愫
    2020-12-13 06:50

    If you already have Spring Core as part of your project, here is an easy way to do it:

    FileSystemUtils.deleteRecursively(dir);
    

    Source:http://www.baeldung.com/java-delete-directory

提交回复
热议问题