extract and update filename based on existing filename in folder

Hello everyone! This is my first time posting, so please let me know if I need to clarify or give more context to what I’m asking!

I need to extract a set amount of data each week for further processing in python and the aquisition portion of the task is quite monotonous. I was hoping to find a solution of:

  1. acquire last weeks’ file name (ex. ‘test file week 99.csv’)
  2. x = 99 (perhaps, strip .csv and locate all characters before the ’ '?)
  3. y = x+1
  4. extract needed data from source
  5. write data to csv with updated naming convention based on y (i.e. ‘test file week y.csv’ where y = 100)
  6. move old file to new folder based on x (i.e. IF file contains x move to new folder, where x == 99)

Is something like this even possible? My concern is that if we were to hit the point of 2-digits to 3-digits, the solution would break, so I am hoping for something that is ready for future digit-changes (such as hitting 1000, etc.)


@ntbohl63 welcome to the KNIME forum.

I think all of this is possible to do by combining the capable KNIME nodes. You can scan for files, extract information like name and date and size

About the extraction of portions of the file name you could use cell splitting or regular expressions to get the number you want to increase.


Hi @ntbohl63,

As @mlauber71 said, regex should be able to pull the number out of the file name regardless of the number of digits.

I haven’t got knime in front of me to test but the Regex Split node applied to the filename string should be able to extract the number portion from the end of the filename format you’ve described with something like this…


Edit: If you want to capture both the bit before the number and the number into two columns, you could use this…