How to create a path to save file to my USB stick

Hi,
The workflow in the picture obliges me to save my data to a specific path where I cannot free space.
Is there another way to create a path?
I would like to save data to external drive.
Thanks,
Zied
image

I’d assume that a temporary directory will always be created on the system volume. Why not explicitly specify a different path instead of using the Create Temp Dir node?

Specifying a different path is exactly what I want to do.
I cannot find the node that can do this.
Thanks,

Looks like the path gets just stored in a Flow Variable here, right? So this could be as easy as using a Rule Engine Variable node (and replace all the pictured nodes with that) and simply hard-code the path in there?

Wouldn’t that work?

PS: In case you need unique path names for each workflow run, you’d need some additional logic to randomly generate a name and create the directory.

Hi there,

Create Temp Dir node creates temporary directory based on directory for temporary files specified in KNIME Preferences.

Changing that directory to other location changes Create Temp Dir node path. Though haven’t tried it out with external drive. Give it a shot and let us know :wink:

Additional note: if it works check if KNIME performance stays the same.

Br,
Ivan

2 Likes

Ipazin’s solution gave me an error after I restart Knime saying that the default workspace … is in use or cannot be created.
I am also curious how to use the Rule Engine Variable. I am not sure in the experssion field.

Hi,

so seems that won’t work.

Can you explain a bit more what are you doing and what data are you trying to save to external drive?

Br,
Ivan

I have a table of long string that I would like to save externally. I need to specify the path where these files will be save and I do not have enough space to save the files in the path that knime suggests.

Hi @zizoo,

I just tested the solution suggested by @ipazin and it worked perfectly.

:blush:

1 Like

The solution of @ipazin worked for me too.
But I would like to learn how to choose where to save the data without playing with Knime setting.
There should be a node where to define an absolute path.
@qqilihq mentioned the Rule Engine Variable but I am still not sure what to write inside the node to define my path.

Maybe you are looking for these nodes:

The first one creates a folder where you want.
The second node creates a file path based on a location you want.

:blush:

2 Likes

Hi,

it worked? Nice surprise :smiley:

Anyways how are you saving your data? With some writer node? If so you can define the absolute path there or using String Manipulation (Variable) node with syntax like:
string(“AbsolutePath”)

Also @armingrudd idea is worth exploring :wink:

If you are wondering about where KNIME saves temporary data then you can not define this inside workflow.

Br,
Ivan

1 Like

Hi @zizoo,

for workflow default settings i allways use the worklow variable setting. e.g. definition of a default path. By use of the Java Edit Variable Node i extend these settings with a file name.

screenshot screenshot2 screenshot3

3 Likes

Thank you guys. I have many options that I can choose from. This is great :smile:

2 Likes

To add a another option, if you have long string cells which you want to save to individual files (i.e. 1 cell in one table row -> 1 file), then the Save File Locally node in the Vernalis community contribution might help - it will also allow you to specify a directory, and a column containing individual filenames which would save you having to generate the full paths manually.

To add to @morpheus’ answer, you can make that snippet a little more robust (and cross-platform-safe if that is an issue for you) using:

return new File($${SDefault_Folder}$$, "Test.csv").getPath();

Steve

3 Likes

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