Question

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?

Was it helpful?

Solution

How about checking if the filename ends with /?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top