creating folders and subfolders from excel files

hello everyone!
I am in trouble because I should do a 'task but I don’t know if it is possible to do it with knime, it would be the starting point for a project of mine., I premise that I use knime every day and I find it great!
I would need to create folders and subfolders that must be named after the text in one or more excel cells.
Input data:

  • excel file (read excel file)
  • for each row (no number is defined, may vary the number of rows each time i update the file) i need to create folders and subfolders that have as name the text present in the single cell.
  • the number of columns and structure are defined and do not change, for example in column A always the main folder, in subsequent columns the structure is always the same only the column name given in the cell changes

I hope I was clear, honestly I am in trouble and I need your help

I thank in advance who can give me some help


@lriva you can do this with knime. You can read the data and then loop thru columns and column names and also create folders with the variables you extracted from the headers.

Maybe you can provide an example representing your task


Isn 't that getting tricky whenever you try to build a multi layer folder structure like the OP mentions? You basically have to look outside the current row in the loop to determine if there is a higher folder and subsequently incorporate it in the path.

If I understood your description correctly @lriva, this might be a starting point.

This first node transposes the data and creates a row based list.

Then I add the root base folder which will be used later on to create the final filepath.

Next, I’m looking at the 7th digit to determine what level it is in the folder structure. This can be achieved with

if (substr(column("Row0"),6,1).equals("")) {

for the base and with

if (substr(column("Row0"),6,1) == var) {

for the others whereby var is equal to the level numbers that you except. In this case 2 and 3.

To fill in the gaps on levels 1 and 2, a Missing Value node can be used.

This now gives sufficient information to start building the filepath with the base and “level” columns. Most efficiently accomplished with a Column Aggregator node.

To allow the creation of the folders, the filepath needs to be of datatype Path instead of string hence the usage of the String to Path node.

Now include the filepath in a Table Row to Variable Loop Start.

Add the Create Folders note and ensure that the Folder is flow variable controlled by the one that you entered in the loop start. Close the loop with a Variable Loop End.

If you let the full loop run, you’ll get your desired folder structure.


See WF:
creating folders and subfolders from excel files.knwf (55.9 KB)

Hope this helps!


thank you ! fantastic
With my knowledge I would never have been able to do it.
if as input data instead of having a single row I have multiple rows is it possible to create multiple Main folders and consequently their subfolders?
thanks in advance

1 Like

I’d use a Chunk Loop as outer loop. With chunk size 1 it will process each row individually with the same logic.

Good morning
Now I have figured out how to create a structure of folders subfolders with “fixed” names, if I wanted to create a structure of folders and subfolders by taking the text in a table or excel field as the name (for example: in cell A1 the name of the main folder, in cells B1-C1-D1 the first level, in cells E1,F1,D1 the second level)
I hope I have explained myself clearly
Sorry if I ask stupid or obvious questions but I am not a programming expert I am trying to learn but I am aware that I lack knowledge
Thanks for the support

Should be doable but can you provide another example in input and expected output in that case?

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