Read file content and containing folder name


I just wanted to know whether or not there's a possibility in KNIME to read in some files from different folders (sharing the same parent folder) and get the file content (as a document or stinrg e.g.) and the folder name into a table or the like.

Reason is, my folder names are categories and the containing files are text files which I want to be allocated to it's category (foldername) while reading them.

I found the Node "List Folders" but that Node will simply give me the different foldernames resp. categories. But then there's no chance to allocate them to the different textfiles I'm reading in using the Node "Flat File Document Parser". I attached a screenshot of what I was thinking of initially. But ofcourse that doesn't work.

I'm hopeing for a Node like the "Flat File Document Parser" including an option to ask for the files folder name, or at least URL or something like that. Couldn't find anythink, though.

Hope that all doesn't sound too confusing.

Thanks and cheers,


Hey Manu,

I think the List Files node in combination with the URL to File Path node should help you with your problem. The former has an option to include sub folders while the latter gives you each file's parent folder.


You need to install the KNIME File Handling Nodes extension to get the URL to File Path node.

Hi Marc,

thanks for your quick answer!

I tried it using those two nodes and it works perfectly fine. Anyway, since I needed to get the text files as a Document as well, along with the filename and the folder (for category), I did a workaround using the Flat File Document Parser together with two Document Data Extractor Nodes.

Result is a table containing the Document together with Filename, Category and Text (all as String).

For future reference I will attach that workflow.