code: private void setRecursivePermission(Path path, OwnerAndPermission ownerAndPermission)
        throws IOException {
      List<FileStatus> files = FileListUtils.listPathsRecursively(this.fs, path, FileListUtils.NO_OP_PATH_FILTER);
  
      // Set permissions bottom up. Permissions are set to files first and then directories
      Collections.reverse(files);
  
      for (FileStatus file : files) {
        safeSetPathPermission(file.getPath(), addExecutePermissionsIfRequired(file, ownerAndPermission));
      }
    }
docs: Sets the {@link FsPermission}, owner, group for the path passed. And recursively to all directories and files under
  it.