private boolean isEmptyArchiveDirDeletable(Path dir) {
    try {
      if (isArchiveDataDir(dir)) {
        return false;
      } else if (isArchiveNamespaceDir(dir) && namespaceExists(dir.getName())) {
        return false;
      } else if (
        isArchiveTableDir(dir)
          && tableExists(TableName.valueOf(dir.getParent().getName(), dir.getName()))
      ) {
        return false;
      }
      return true;
    } catch (IOException e) {
      LOG.warn("Check if empty dir {} is deletable error", dir, e);
      return false;
    }
  }
Implementation of a file cleaner that checks if a empty directory with no subdirs and subfiles is
deletable when user scan snapshot feature is enabled
hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SnapshotScannerHDFSAclCleaner.java