# Attempting to stage multiple files into a directory

**URL:** <https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044>\
**Category:** CWL Questions\
**Created:** [March 30, 2026, 4:32pm UTC](https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044 "2026-03-30T16:32:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![skgo](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@skgo](https://cwl.discourse.group/u/skgo)\
**Post date:** [March 30, 2026, 4:32pm UTC](https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044/1 "2026-03-30T16:32:09Z")

</div>

I am attempting to pass in multiple files as inputs and stage those specific files into a directory, which is provided as a named input to my tool. Specifically, this is for hisat2. I am unable to provide them up front in a directory due to other limitations not related to CWL or hisat2. Here is an example of how I’ve constructed the folder:

```auto
requirements:
  InlineJavascriptRequirement: {}
  InitialWorkDirRequirement:
    listing:
      - entryname: "hisat2_index"
        entry: |
          ${
            return {
              "class": "Directory",
              "listing": [inputs.hisat2_idx_1, inputs.hisat2_idx_2, inputs.hisat2_idx_3, inputs.hisat2_idx_4, inputs.hisat2_idx_5, inputs.hisat2_idx_6, inputs.hisat2_idx_7, inputs.hisat2_idx_8]
            };
          }

```

And here is how I am attempting to use it:

```auto
arguments:
  - prefix: -x
    valueFrom: hisat2_index

```

I have also tried:

```auto
arguments:
  - prefix: -x
    valueFrom: $(runtime.outdir)/hisat2_index

```

In both cases I receive the error `(ERR): "hisat2_index" does not exist` or `(ERR): "/vBrQqO/hisat2_index" does not exist` respectively. Is there something I’m missing?

---

<div class="post-metadata">

**Author:** ![davidjsherman](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/davidjsherman/32/205_2.png) [@davidjsherman](https://cwl.discourse.group/u/davidjsherman)\
**Post date:** [April 1, 2026, 8:14am UTC](https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044/2 "2026-04-01T08:14:02Z")

</div>

I find it easier to specify the directory base name in the returned Directory object.

```auto
requirements:
  InlineJavascriptRequirement: {}
  InitialWorkDirRequirement:
    listing:
      - |2
          ${
            var asset = {
              basename: "hisat2_index",
              class: "Directory",
              listing: [
                inputs.hisat2_idx_1,
                inputs.hisat2_idx_2,
                inputs.hisat2_idx_3,
                inputs.hisat2_idx_4,
                inputs.hisat2_idx_5,
                inputs.hisat2_idx_6,
                inputs.hisat2_idx_7,
                inputs.hisat2_idx_8
              ],
              writable: false
            };
            return asset;
          }

```

---

<div class="post-metadata">

**Author:** ![skgo](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@skgo](https://cwl.discourse.group/u/skgo)\
**Post date:** [April 1, 2026, 5:58pm UTC](https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044/3 "2026-04-01T17:58:50Z")

</div>

How exactly do I reference that directory? When I use your changes and run with the `--debug` flag it appears that the directory is correctly being created:

```auto
DEBUG [job hisat2.cwl] initial work dir {
    "_:40d2c1d0-92eb-4686-a1be-67c81157d6c9": [
        "_:40d2c1d0-92eb-4686-a1be-67c81157d6c9",
        "/CkSeWc/hisat2_index",
        "Directory",
        true
    ],

```

and I do see it being populated with files:

```auto
"file:///my_input_path/hg38.1.ht2": [
        "/my_input_path/hg38.1.ht2",
        "/CkSeWc/hisat2_index/hg38.1.ht2",
        "File",
        true
    ],

```

However, when I try to use that directory like so:

```auto
arguments:
  - prefix: -x
    valueFrom: $(runtime.outdir)/hisat2_index

```

I get the error:

```auto
(ERR): "/CkSeWc/hisat2_index" does not exist

```

---

<div class="post-metadata">

**Author:** ![skgo](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@skgo](https://cwl.discourse.group/u/skgo)\
**Post date:** [April 2, 2026, 4:49pm UTC](https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044/4 "2026-04-02T16:49:02Z")

</div>

I’ve done some test runs keep the tmpdir for inspection and am having trouble making sense of the results. When I run with a container image I see it’s mounting the tmpdir like so:

```auto
--mount=type=bind,source=/tmp/fx8xwvn0,target=/LqxIIY

```

and when I `ls /tmp/fx8xwvn0` I see that hisat2\_index exists and is populated as expected. However, I am getting the error `(ERR): "/LqxIIY/hisat2_index" does not exist`. It seems to me that based on the mounting that that path should exist.

I’ve also tried running this without a container to attempt to diagnose if this is just a container specific issue. When I do that I see

```auto
INFO [job hisat2.cwl] /tmp/hh3_owur$ hisat2 \
    -x \
    /tmp/hh3_owur/hisat2_index \
    -k \
    1 \
    -1 \
    /tmp/sp2h1bwd/stg4906f7cd-d64d-4d88-bbaa-35df80ba6f2c/tmp_r1.fq \
    -2 \
    /tmp/sp2h1bwd/stgae1e9627-dafa-4298-9c13-c65f1da4c329/tmp_r2.fq \
    -S \
    aligned.sam
(ERR): "/tmp/hh3_owur/hisat2_index" does not exist

```

but I can run `ls /tmp/hh3_owur/hisat2_index` and see that it does exist and is populated with all of the files as expected.

---

<div class="post-metadata">

**Author:** ![skgo](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@skgo](https://cwl.discourse.group/u/skgo)\
**Post date:** [April 2, 2026, 7:46pm UTC](https://cwl.discourse.group/t/attempting-to-stage-multiple-files-into-a-directory/1044/5 "2026-04-02T19:46:35Z")

</div>

I swapped to using this

```auto
requirements:
  InitialWorkDirRequirement:
    listing:
      - entryname: hisat2_index/hg38.1.ht2
        entry: $(inputs.hisat2_idx_1)
      - entryname: hisat2_index/hg38.2.ht2
        entry: $(inputs.hisat2_idx_2)
      - entryname: hisat2_index/hg38.3.ht2
        entry: $(inputs.hisat2_idx_3)
      - entryname: hisat2_index/hg38.4.ht2
        entry: $(inputs.hisat2_idx_4)
      - entryname: hisat2_index/hg38.5.ht2
        entry: $(inputs.hisat2_idx_5)
      - entryname: hisat2_index/hg38.6.ht2
        entry: $(inputs.hisat2_idx_6)
      - entryname: hisat2_index/hg38.7.ht2
        entry: $(inputs.hisat2_idx_7)
      - entryname: hisat2_index/hg38.8.ht2
        entry: $(inputs.hisat2_idx_8)

```

and it’s working now. I’m not entirely sure why, but at least it’s working now. Perhaps I had a typo somewhere.
