Search code examples
pythonpython-2.7zippython-zipfile

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?


Solution

  • How about checking if the filename ends with /?