Directory / Folder path as variable


I am trying to create a component. This component job is to:

  1. create a directory / folder called ‘process’ (if it doesn’t exist) in the top level (see below).
  2. create a child directory / folder in process (the name will be randomised)
  3. Pass the child directory / folder path out as a flow variable
    Inputs: None. Outputs: flow variable: child path.

My KNIME Explorer window looks a bit like this:

If the component is placed into the Calculate Life Expectancy Workflow I would want it to produce the ‘process’ folder where it says ###HERE### and child folder within it.

But, the component must work if I placed it in any of the other groups and when I deploy it to the server it must work there too. e.g. if the component is placed in the Enterprise Scotty Pessimistic Score, the process folder would be in the Enterprise Scotty Pessimistic Score group.

I can not figure out a way for KNIME to get the path required to create the process folder and its child folder.

Does anyone have any ideas?


It’s hard to tell without your workflow, but as a first guess:

You can set Path values to “Relative to” and then “Current workflow” or “Current workflow data area” (which is a folder named “data” inside the workflow folder).

Your paths then only need to consist of the last part and will adapt accordingly if you move the workflow somewhere else (colleages machine, server, …).

Hello Thyme

Thank you!

For future readers:
I have attached the workflow below.
In the original component spec I wanted the process folder to be below the parent e.g. Enterprise Landing Party Life Expectancy. This workflow does not do that, it does (as Thyme explained) put it into a folder named ‘data’ inside the workflow folder.


P.S. I know the component name is way to long!

1 Like

Interesting, I thought it’s possible to write to the workflow directory as well, either using “current workflow” or bypassing the restriction using ../ but no, didn’t work. It’s probably better to stick to the data area anyway.

Thanks for verifying my solution! :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.