title: Nextflow name collision
body: <p>I have files with identical names but in different folders. Nextflow stages these files into the same work directory resulting in name collisions. My question is how to deal with that <strong>without</strong> renaming the files. Example:</p>
  <pre class="lang-bash prettyprint-override"><code># Example data
  mkdir folder1 folder2
  echo 1 &gt; folder1/file.txt
  echo 2 &gt; folder2/file.txt
  
  # We read from samplesheet
  $ cat samplesheet.csv
  sample,file
  sample1,/home/atpoint/foo/folder1/file.txt
  sample1,/home/atpoint/foo/folder2/file.txt
  
  # Nextflow main.nf
  #! /usr/bin/env nextflow
  
  nextflow.enable.dsl=2
  
  // Read samplesheet and group files by sample (first column)
  samplesheet = Channel
      .fromPath(params.samplesheet)
      .splitCsv(header:true)
      .map {
              sample = it['sample']
              file   = it['file']
              tuple(sample, file)
  }
          
  ch_samplesheet = samplesheet.groupTuple(by:0)
  
  // That creates a tuple like:
  // [sample1, [/home/atpoint/foo/folder1/file.txt, /home/atpoint/foo/folder2/file.txt]]
  
  // Dummy process that stages both files into the same work directory folder
  process PRO {
  
      input:
      tuple val(samplename), path(files)
  
      output:
      path(&quot;out.txt&quot;)
  
      script:
      &quot;&quot;&quot;
      echo $samplename with files $files &gt; out.txt
      &quot;&quot;&quot;
  
  }
  
  workflow { PRO(ch_samplesheet) }
  
  # Run it
  NXF_VER=21.10.6 nextflow run main.nf --samplesheet $(realpath samplesheet.csv)
  
  </code></pre>
  <p>...obviously resulting in:</p>
  <pre><code>N E X T F L O W  ~  version 21.10.6
  Launching `main.nf` [adoring_jennings] - revision: 87f26fa90b
  [-        ] process &gt; PRO -
  Error executing process &gt; 'PRO (1)'
  
  Caused by:
    Process `PRO` input file name collision -- There are multiple input files for each of the following file names: file.txt
  </code></pre>
  <p>So, what now? The real world application here is sequencing replicates of the same fastq file, which then have the same name, but are in different folders, and I want to feed them into a process that merges them. I am aware of this <a href="https://www.nextflow.io/docs/latest/process.html#multiple-input-files" rel="nofollow noreferrer">section in the docs</a> but cannot say that any of it was helpful or that I understand it properly.</p>