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
Some of these answers seem unnecessarily long:
if (directory.exists()) { for (File file : directory.listFiles()) { file.delete(); } directory.delete(); }
Works for sub directories too.