Delete directories recursively in Java

You should check out Apache’s commons-io. It has a FileUtils class that will do what you want.

FileUtils.deleteDirectory(new File("directory"));

Leave a Comment