Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if entry is file or folder using Python's standard library zipfile?

I have a zip file and I need to check if a file is a folder or a file without extracting them. I could check it using file_size property of infolist if it is 0 but this is the same for a file with 0 size. So it is not useful.

I looked on the ZIP specification but that didn't helped much either.

How to check if entry is file or folder using Python's standard library zipfile?

like image 271
Eduard Florinescu Avatar asked Feb 17 '23 06:02

Eduard Florinescu


1 Answers

How about checking if the filename ends with /?

like image 188
robertklep Avatar answered Feb 19 '23 19:02

robertklep