Reading file names and creating folders and transferring data into them

I have a folder with the following conditions
1- There are a lot of zip files
2- The file names are all unique.
3- Part of the file name is a phone number that starts with 0. (For example sddsaw233_09193443344_ffr.zip or 09193443344_fdsdf.zip)
4- There is a β€œ-” sign before or after the phone number.
I want to design a workflow through knime that:
1- Categorize these zip files based on the numbers in their names
2- Create a folder for each phone number and move each file that has a phone number in its name, which is the name of the folder, to the folder.

Hi @alex1368

Take a look at this workflow I’ve uploaded onto the hub

You’d need to set the values for your base source and destination folders in the Variable Creator at the beginning.

Your examples had underscores in the name whereas you wrote β€œ-”, so I assumed that the underscore is actually the character to look for in finding the phone numbers. I don’t know if your phone numbers are always a set number of digits, but I’ve just assumed any sequence of digits that starts with β€œ0”.

source files:

image

destination files:
image

2 Likes