Download Multiple Files -- Custom tool development: Writing outputs to the user history as datasets

Hello,
I am new to Galaxy. I developed a tool wherein I am storing the output (multiple files) of the tool after it finishes running into a directory which I create during runtime (the directory name has the following format: <system_time_in_milliseconds>_<random_5_digit_number>).

Now my main aim is, how can I get the name of the directory created during runtime in my XML code. Also, how can I set the output of the tool in the XML file to point to the contents of the directory.

I did look into the documentation, the tag has an attribute from_work_dir, can you please provide me with an example of how to use this.

My XML File Looks like this:

<tool id="tool1" name="tool1" version="1.0.0">
    <command detect_errors="exit_code"><![CDATA[
    python3 $__tool_directory__/python_script_file.py $input1 email@mail.com -s $input1 -m GTRGAMMA -f d -N 500
    ]]></command>
  <inputs>
    <param type="data" format="data" name="input1" label="Input file"/>
  </inputs>
  <outputs>
    <data name="output1" from_work_dir="<don't know what to put here>"/>
  </outputs>
  <help>
Tool
  </help>

</tool>
1 Like

Hi @Saahil_Anil_Chawande,

Since Galaxy will launch every single job in a dedicate working directory, why do you need to name your directory like this?

By the way, if you need to get several files from a directory, I can advice you to look at this: https://docs.galaxyproject.org/en/latest/dev/schema.html#tool-outputs-collection-discover-datasets
Or https://docs.galaxyproject.org/en/latest/dev/schema.html#tool-outputs-data-discover-datasets if you aren’t interesting in Dataset Collection.

1 Like