# Create/Move output of a tool to a specific location

**URL:** <https://cwl.discourse.group/t/create-move-output-of-a-tool-to-a-specific-location/51>\
**Category:** CWL Questions\
**Created:** [October 28, 2019, 12:45am UTC](https://cwl.discourse.group/t/create-move-output-of-a-tool-to-a-specific-location/51 "2019-10-28T00:45:44Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![ttubb](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/ttubb/32/37_2.png) [@ttubb](https://cwl.discourse.group/u/ttubb)\
**Post date:** [October 31, 2019, 3:03am UTC](https://cwl.discourse.group/t/create-move-output-of-a-tool-to-a-specific-location/51/6 "2019-10-31T03:03:24Z")

</div>

Hi Sherish,

I’m sorry, there was one `type` too many in my initial suggestion. Please try the following tool wrapper:

```
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool

hints:
 DockerRequirement:
   dockerImageId: umccr/pipeline-cwl

requirements:
  InlineJavascriptRequirement: {}
  EnvVarRequirement:
    envDef:
      DEPLOY_ENV: $(inputs.denv)

inputs:
  denv: string
  samplesheet:
    type: File
    inputBinding:
      position: 1
  config:
    type: Directory
    inputBinding:
      position: 2

outputs:
  log_out:
    type: stdout
  split_samplesheets:
    type: Directory
    outputBinding:
      glob: .
      outputEval: |
        ${
          self[0].basename = "output";
          return self[0]
        }

stdout: samplesheet-check.log

baseCommand: [python, /scripts/samplesheet-check.py]

```

Regarding the `outputBinding` for `split_samplesheet`: `glob: .` instructs cwl to collect the current working directory as output. This should contain all the data that the python script has written. The working directory gets created by your cwl-runner at runtime, and will have a random collection of characters as a name. This is why we use `outputEval` to change the `basename`-property of the directory to a name of our choosing (in this case: “output”).

What you cannot do is instruct the `CommandLineTool` to create output at any specific location, it is constrained to the temporary directory used at runtime. For this purpose, use the corresponding argument of your cwl-runner. For cwltool this would be `--outdir myDirectory`

I hope this helps!

Cheers,  
Tom

---

_[View the full topic](https://cwl.discourse.group/t/create-move-output-of-a-tool-to-a-specific-location/51)._
