code: private static void getDirectoryListing(FileStatus root, FileSystem fs,
        List<CopyPath> result, Path dstPath) throws IOException {
      if (!root.isDir()) {
        result.add(new CopyPath(root.getPath(), dstPath));
        return;
      }
  
      for (FileStatus child : fs.listStatus(root.getPath())) {
        getDirectoryListing(child, fs, result, new Path(dstPath, child.getPath()
            .getName()));
      }
    }
docs: Recursively lists out all the files under a given path.
  
  @param root
  the path under which we want to list out files
  @param fs
  the filesystem
  @param result
  the list which holds all the files.
  @throws IOException