private static boolean toBeDeleted(String path, Set<String> deletedPaths, Set<String> deletedLinks) {
    if (deletedPaths.contains(path)) return true;
    if (!deletedLinks.isEmpty()) {
      int p = path.length();
      while ((p = path.lastIndexOf('/', p - 1)) > 0) {
        if (deletedLinks.contains(path.substring(0, p))) return true;
      }
    }
    return false;
  }
private static boolean toBeDeleted(String path, Set<String> deletedPaths, Set<String> deletedLinks)