Extract and rename the zip file using the Excel list

I have a large number of zip files (their content is an Excel file) part of whose name is written on the file and their full names are stored in an Excel list, I want to use kmine to unzip them and name it Automatically change files using Excel list
Please help me

HI @alex1368 and welcome to the Knime Community.

Just to make sure I understand what you are trying to do. Do you want to unzip the files, and then rename the files based on the mapping from your Excel file, is that correct?

What have you tried so far?

You can use the Decompress File node to unzip

You can use the Transfer Files node to rename the file (rename is basically moving the file to a new file name)

Personally, I prefer using the OS’ own rename command, which is much faster. I usually use Knime to build a file containing the rename commands of the files (Knime does not really “move” files, but rather copy and delete).

Thank you for your attention
I used unzip file to remove the zipper, but I do not know what to do to change the group name !!!
I extract a large number of zip files and I want the automatic software to rename the extracted files according to the name of the zip file and the Excel file, which is almost the same with a slight difference.

I’m not sure I understand what this mean? What do you mean by group name?

Hello again and I apologize!
I have several zip files that contain an Excel file.
The names of these files are based on numbers.
I have another Excel file that has a number column in it (exactly the names of the zip files) and a caption in the opposite column.
my request:
1- I want the system to extract all my files in one go and in general.
2- Rename it according to the file name and paste the desired name from inside the Excel file.

Hi @alex1368 , it is what I understood the first time, and I suggested to you the main nodes that you needed to use.

I put a demo for you so you can understand how to link everything. This is what it looks like:

For the sake of the demo, I have a zipped file and an Excel file containing the number and caption:

The Excel file contains the following information:

The zip file contains 5 Excel files:

And for tracking after the rename, I added a number in the first cell of each of these 5 Excel files:

After running the workflow, these are the files I have:

So, 7 files in total, which is what’s expected (original 2 files + the 5 unzipped files).

If I open the 5 files that have been renamed, we can see that the files have correctly been renamed:

Here’s the workflow (demo zip and excel files included): Extract files from zip and rename based on mapping.knwf (59.8 KB)


Great explanation @bruno29a . Was the pyth to uri necessary? If you only need the file path you could also extract it without that or am I missing something?

Hi @Daniel_Weikert , the Path to URI was to be able to use the URL to File Path, which reads from a URI column. The node name URL To File Path is misleading. You don’t actually get a column of type Path. This node actually gives you the string path of the Parent folder, File name, File extension, and the string full path of the file. What I was interested in getting here was the File name and File extension.

Download the workflow and check it out, you will understand :slight_smile:

EDIT: Basically, these 2 nodes combined allowed me to get these 2 columns:


Thanks, yes I downloaded it. Just thought you could extract this info from the first path column directly.

Thank you for your unique guidance !!!
This is what I wanted
I have only two questions and that is:
1- What should I do if I have 10 zip files? Can zip files be selected as a group? What should I do if it is equal to the name of the zip file?
2- If I want the name of the files inside the zipper (ie if the letter of the zip file is Arash and the names of the files inside are, for example, the zip file 1233123_conver and 767878_own) to be merged with the name of the zip file (for example, Arash _conver and Arash_own output)], what should I do? do?

Hi @alex1368 , please include the user’s name (with the @ sign, like I am doing to you), so that the user can receive a notification. I did not know you were asking a question until I checked the thread.

If you have 10 zip files you want to process, you can do all this in a loop. Use the List Files/Folders node to point where the zip files are. There are Filter options there where you can filter on only files with extension .zip.

This will show you all the zip files in that folder:

(This is using the same demo I made earlier, so in my case there is only 1 zip file, but the logic is the same for multiple zip files)

After that, you can use the Table Row to Variable Loop Start. The loop will go through the table containing the list of the zip files and in each iteration, will create a variable called Path containing the path to the zip file of that iteration:

You can then link it to the workflow:

And in the Decompress Files node, you can point to that variable:
Click on this button:

You will get this popup. Choose the Path variable from the dropdown:
Click OK, and now the zip file to use become dynamic. You should see this message at the bottom:

Here’s the workflow with the loop: Extract files from zip and rename based on mapping.knwf (69.6 KB)

You can adapt this to your specific needs. For example:
“Can zip files be selected as a group?”:
You can do Row Filter or Row Splitter after the List Files/Folders to include/exclude the zip files as a group.

“What should I do if it is equal to the name of the zip file?”:
What does “it” refer to? What is it that’s equal to the name of the zip file?

I don’t quite understand what you mean for your question 2. Can you give more details? Like give me full file name with extension so I know what’s a file name, and what the entry in your Excel mapping name (number and caption) is?


Hello @ bruno29a
Thank you very much for your accurate answers !!! It is appropriate for me to call you my master
thank you

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