private Job statInputFiles(Job parent) {
    Job statFiles = this.getWorkflow().createBashJob("stat downloaded input files");
    String moveToFailed =
        GitUtils.gitMoveCommand(
            "running-jobs",
            "failed-jobs",
            this.JSONlocation + "/" + this.JSONrepoName + "/" + this.JSONfolderName,
            this.JSONfileName,
            this.gitMoveTestMode,
            this.getWorkflowBaseDir() + "/scripts/");
    String statFilesCMD = "( ";

    for (VcfInfo vcfInfo : this.vcfs) {
      boolean useGnosIdInPath =
          vcfInfo.getOriginatingPipeline() != Pipeline.smufin
              && this.pipelineDownloadMethods.get(vcfInfo.getOriginatingPipeline())
                  != DownloadMethod.filesystemCopy;
      // Remember: smufin won't have a gnos ID so don't try to use that in the path for stat.
      String prefix =
          "stat /datastore/vcf/"
              + vcfInfo.getOriginatingPipeline().toString()
              + "/"
              + (useGnosIdInPath ? vcfInfo.getPipelineGnosID() + "/" : "");
      statFilesCMD += prefix + vcfInfo.getFileName() + " && \\\n";
      statFilesCMD += prefix + vcfInfo.getIndexFileName() + " && \\\n";
    }

    // stat all tumour BAMS
    for (int i = 0; i < this.tumours.size(); i++) {
      String prefix =
          "stat /datastore/bam/"
              + BAMType.tumour.toString()
              + "/"
              + (!this.bamDownloadMethod.equals(DownloadMethod.filesystemCopy.toString())
                  ? this.tumours.get(i).getTumourBamGnosID() + "/"
                  : "");
      statFilesCMD += prefix + this.tumours.get(i).getTumourBAMFileName() + " && \\\n";
      statFilesCMD += prefix + this.tumours.get(i).getTumourBamIndexFileName() + " && \\\n";
    }

    String normalPrefix =
        "stat /datastore/bam/"
            + BAMType.normal.toString()
            + "/"
            + (!this.bamDownloadMethod.equals(DownloadMethod.filesystemCopy.toString())
                ? this.normalBamGnosID + "/"
                : "");

    statFilesCMD += normalPrefix + this.normalBAMFileName + " && \\\n";
    statFilesCMD += normalPrefix + this.normalBamIndexFileName + " \\\n";
    statFilesCMD += " ) || " + moveToFailed;

    statFiles.setCommand(statFilesCMD);

    statFiles.addParent(parent);
    return statFiles;
  }