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
One more choice is to use Spring's org.springframework.util.FileSystemUtils relevant method which will recursively delete all content of the directory.
org.springframework.util.FileSystemUtils
File directoryToDelete = new File(); FileSystemUtils.deleteRecursively(directoryToDelete);
That will do the job!