code: public static void recursiveDelete(Path directory) throws IOException   {
  
          try {
              Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
                  @Override
                  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException {
                      try {
                          Files.delete(file);
                      } catch (NoSuchFileException ignore) {}
                      return FileVisitResult.CONTINUE;
                  }
  
                  @Override
                  public FileVisitResult postVisitDirectory(Path dir, java.io.IOException exc) throws java.io.IOException {
                      try{
                          Files.delete(dir);
                      }catch (NoSuchFileException ignore){}
                      return FileVisitResult.CONTINUE;
                  }
              });
          } catch (NoSuchFileException ignore) {}
  
      }
docs: Deletes a directory recursively with all its contents. Will ignore files and directories if they are disappear during the oprtation.
  
  @param directory directory to delete.