code: public static void deleteDirectory(Path dir) throws IOException {
  		if(dir == null || !Files.exists(dir))
  			return;
  		Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
  	        @Override
  	        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
  	            Files.delete(file);
  	            return FileVisitResult.CONTINUE;
  	        }
  
  	        @Override
  	        public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
  	            if (e != null) {
  	                throw e;
  	            }
  	            Files.delete(dir);
  	            return FileVisitResult.CONTINUE;
  	        }
  	    });
  	}
docs: Recursively delete a folder & contents
  
  @param dir directory to delete