create a directory (name provided via flow variable)

Hello there,

in my current workflow I want to save files to a directory which is also created by the workflow.

The directory is created using the “create directory” node with the path/name provided via a flow variable (name changes depending on WF). The variable already contains the full path, so it already works as planned. However, in the options part of the configuration, it doesn’t allow me to omit the “Name” setting.
It appears to be intended for the actual directory the user might want to create, but can’t be controlled by flow variables, so it’s “condemned” to be a fixed value. My workaround is to put a single underscore in that field and a few subsequent nodes to delete that additional directory. It works, but isn’t very pretty.

Is there a cleaner solution available?

I’ve also tried the super-old solution provided here:


but Java snippets don’t recognise the “File” type. Either way would be ok with my OCD :wink:

Thanks, Thyme

See attached.Create Dir.knwf (7.8 KB)
Also, it looks like there is inconsistency with the Name parameter. I used fake name just to be able to save configuration even though on flow variable tab parameter was set using variable Row1.

Yes, that is exactly what I was talking about in the OP.
Right now I’m deleting that fake directory again, but it feels like a limping solution.

Hi there @Thyme,

why having everything in one flow variable and not using two flow variables? One for location and other for folder name?

Br,
Ivan

Hello Ivan,

that’s what I’d’ve done, if the node would let me. However, the Name parameter has no flow variable option (see attached screenshot).
So I’m “stuck” with one flow variable only. That would work too, if the second parameter wasn’t mandatory.

Cheers, T

You can see in my example haw to assign variable to name:

2 Likes

I didn’t know you could do that … I’m a bit dumbfounded right now, but that’s ok.

Thank you for showing me that feature, it will probably make some other things easier as well.

Sweet dreams, T

1 Like

Happy to help, Thyme.

1 Like

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