4

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?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179

1 Answers1

8

How about checking if the filename ends with /?

robertklep
  • 198,204
  • 35
  • 394
  • 381