更新时间:2022-12-30 11:29:04
Simplest way would be to use FileUtils.deleteDirectory from the Apache Commons IO library.
File dir = new File("root path");
FileUtils.deleteDirectory(dir);
请记住,这也会删除包含目录.
Bear in mind this will also delete the containing directory.
在gradle文件中添加此行以使用Apache
Add this line in gradle file to have Apache
compile 'org.apache.commons:commons-io:1.3.2'