code: public static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
        boolean applyFilterToDirectories, boolean includeEmptyDirectories) throws IOException {
      List<FileStatus> files = Lists.newArrayList();
      FileStatus rootFile = fs.getFileStatus(path);
  
      listFilesRecursivelyHelper(fs, files, rootFile, fileFilter, applyFilterToDirectories, includeEmptyDirectories);
  
      // Copy the empty root directory
      if (files.size() == 0 && rootFile.isDirectory() && includeEmptyDirectories) {
        files.add(rootFile);
      }
      return files;
    }
docs: Given a path to copy, list all files rooted at the given path to copy
  
  @param fs the file system of the path
  @param path root path to copy
  @param fileFilter a filter only applied to root
  @param applyFilterToDirectories a control to decide whether to apply filter to directories
  @param includeEmptyDirectories a control to include empty directories for copy