Hello colleagues, good afternoon!
I hope you’re all okay.
I have a question regarding .zip files…
Can I get a list of all files that are inside a .zip file without needing to unzip it?
My situation is a list of approximately 10 zip files, where inside each one there are 100 files.
I need to find out which of these 10 zip files is a specific file that I will identify by its default name.
How do you think is the best way to handle this?
Will I need to unzip all the zip files to find the file I want and then delete the ones that won’t be useful?
Can I do a “for each” for these zip files, looking for my specific file?
Note: Concerning custom library packages, I would like you to avoid them, as my organization (company) is not very fond of using materials that are not official UiPath…
I believe we need to unzip it to read the file path of each files in it
because if we try to get the filepath of all files inside zipped folder, it will throw error
In order to get the list of file names inside a zip file you can use a python library “zipfile”. As python integration is possible in UiPath using Python Scope you can try this method.
from zipfile import ZipFile
with ZipFile('file.zip', 'r') as zip:
for info in zip.infolist():
print(info.filename)
The code above gives the list of file names inside the “file.zip” zip file.
Hello @Palaniyappan, good morning!
Sorry for the delay to reply.
I don’t know if it’s my version of UiPath or something like that, but I haven’t found this activity you mentioned…
Was it some special package or something?
Hello @kumar.varun2, good morning!
Sorry for the delay to reply.
I liked your alternative, very simple and practical… But when I saw the activity I was a little lost… In which Input do I put the code?
Would you help me?
But I have the package installed, what’s causing a problem is the parameters that I inserted in the activity/code. Because of that, it’s generating that error up there …
Can you identify what I put wrong in the activity and in the code?
Hello everyone!
I thank each one individually who was willing to help me with the situation. Of all the possibilities, the one I got successfully was @kumar.varun2! =D
Because I’m using UiPath in my company, the versions used are a bit old, so there are some packages we don’t usually use, as well as some newer activities.
Regarding the @kumar.varun2 solution, I just changed the wrong parameters, after I stopped and thought a little, I managed to use it and it works perfectly.