I want to create and delete a directory using Java, but it isn\'t working.
File index = new File(\"/home/Work/Indexer1\");
if (!index.exists()) {
index.m
Guava 21+ to the rescue. Use only if there are no symlinks pointing out of the directory to delete.
com.google.common.io.MoreFiles.deleteRecursively(
file.toPath(),
RecursiveDeleteOption.ALLOW_INSECURE
) ;
(This question is well-indexed by Google, so other people usig Guava might be happy to find this answer, even if it is redundant with other answers elsewhere.)