detect extension in directory

How can I extract all the extensions in a folder by the number of each one?

For example, several Excel files, several PDFs, several texts, etc.

My intended output:
csv : 114
pdf: 205
text: 40
movie: 16
and …

Hi @behghorchiknime

Welcome to KNIME Forum !

Start with the List Files/Folders node and connect it to a String Manipulation node.
Schermafdruk van 2023-07-04 07-43-23
Configure the String Manipulation node as follows;

substr($Path$, lastIndexOfChar($Path$,'.' )+1)

gr. Hans

1 Like

… and for the counts, you can then use a GroupBy node with a count aggregation:

-Philipp

3 Likes

I want to show how many extensions are in the folder
Like the bottom line

csv : 114
pdf: 205
text: 40
movie: 16
and …

Hello @behghorchiknime and welcome to the KNIME community
Aiming to make your life easier, you can concatenate the following nodes:

  1. Start with your ‘List Files/Folders’ node returning a column in path format.

  2. ‘Path to String’ node:
    Path to String – KNIME Community Hub

  3. ‘URL to File Path’ node, this node will return a file extension column ready to use:
    URL to File Path – KNIME Community Hub

  4. And last but not least, as @qqilihq suggested: group by ‘file extension’ column

BR

1 Like

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