code: private void processHDFSSource(FileSystem hdfs, FileStatus f,
        Path outputPath, Configuration conf, boolean skipExisting, boolean retain)
        throws IOException {
  
      long fileModTime = f.getModificationTime();
      Path targetDir = getTargetDirectory(hdfs, outputPath, fileModTime);
  
      boolean targetExists = false;
      Path target = new Path(targetDir, f.getPath().getName());
      targetExists = hdfs.exists(target);
  
      if (moveFiles || !retain) {
        if (targetExists) {
          hdfs.delete(f.getPath(), false);
        } else {
          hdfs.rename(f.getPath(), targetDir);
        }
      } else {
        if (targetExists && skipExisting) {
          // Do nothing, target is already there and we're instructed to skip
          // existing records.
        } else {
          copy(hdfs, f, conf, targetDir);
        }
      }
    }
docs: @param hdfs
  FileSystem handle
  @param f
  file to process
  @param outputPath
  @param conf
  configuration to use for copying.
  @param skipExisting
  skip if the file already exist in the target. File will be
  overwritten if already there and this argument is false.
  @retain whether this file should be retained
  
  @throws IOException