List Files/Folders - Relative to Workflow Data Area (main /data/ directory)

I am struggling to get the List Files/Folders (or any other node) to accept the main workflow data area (/data/) as a Relative path either by entry or by flow variable. I have always used calculated absolute paths as a work around, but it would be way cleaner to be able to keep them as a relative path for simplicity.

The Relative to Workflow Data Area methodology seems to default to the data folder itself, but then for some reason it requires you to select a subfolder in order for it to be valid. Why wouldn’t it point to the main data folder when no sub-folders are selected? :face_with_head_bandage: Anyone found a workaround to create relative links to the main data folder?

Hello @iCFO
I created a workflow by last March to provide a solution that transferred files in Loop. Aiming to implement it working for any download from Hub, I had to make it work from Workflow Data Area.

You may take advantage of the learning curve; it works even from temporary -when executing it straight away from ‘Downloads’ folder-, without saving it into knime-workspace.

BR

4 Likes

This will be helpful if I run into issues requiring temp file locations in unsaved workflows. It looks like your Relative path List File/Folder pointed to sub folders in the workflow data folder, and not the main data folder.

A relative path to the main workflow data folder seems like such a basic requirement… It feel like I must be missing something obvious since this is such a commonly used directory.

@iCFO I think what you are looking for is a path relative to the current workflow and then:

../data/

A double …/…/data from the workflows data folder would not work. I assume this is so no one accidentally messes with the functional files of the workflow itself.

3 Likes

Thanks @mlauber71

It looks like it is working on your end, but not on mine. The same settings on my end say that no files are matching the filters even though there are no filters set and files are present the folder.

@iCFO mabye you can download the workflow group and try for yourself with this workflow List PNG files from /graphic/ folder load them into a KNIME table and export them with a new name to /data/ folder – KNIME Community Hub. Or I might miss something

I will try it when I am back in the office. Are your files in the main /data/ folder or in sub folders? I suspect it is blocking my file access to the main folder.

@iCFO the workflow and the folder are on the same ‘level’.

And just to be sure: relative to “current workflow” (not its data area)

If it is still not working: this is on a ‘normal’ machine not some remote cloud folder or something?

I am referring to files in the data folder. Do you have any files in the main data folder (data/example.table), or sub folders (data/sub folder/example.table)?

@iCFO maybe it would be best if you could create an example.

I have it! The main data folder is actually just . . /

Thanks for your help @mlauber71 !

4 Likes

@iCFO glad it worked. It was either something very complicated or very simple. The two dots should be there by default :slight_smile:

2 Likes

I marked mine as a solution to get future users to the right spot, but full credit goes to the great @mlauber71

Thanks a ton.

1 Like

Here is a link to an Interactive View based component using this relative data file reference. It is a stand alone 1 time file launcher / folder viewer for the relative data folder contents of a workflow. It is just designed to be an easy manually controlled shortcut to make data file changes without exiting KNIME.

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