private static void createFileList(Set<FileStatus> filesKept, Path srcPath, Path targetPath, FileSystem fs)
      throws IOException {
    try (FSDataOutputStream outStream = fs.create(new Path(targetPath, BLOB_MANIFEST_FILE))) {
      // Adding the first entry in the manifest file as the source path, the entries post that are the files to be
      // copied.
      outStream.writeBytes(srcPath.toString() + System.lineSeparator());
      for (FileStatus file : filesKept) {
        outStream.writeBytes(file.getPath().toString() + System.lineSeparator());
      }
    }
    LOG.debug("Created path list at path: {}", new Path(targetPath, BLOB_MANIFEST_FILE));
  }
returns null if path is not exist
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java