0

Checking Whether A Folder Is Empty Or Not.

How can i ckeck wether a folder is empty or not using python ? I'm creating a face recognition program in opencv and i need to check wether the folder where the testing image should be is empty ot not. Any help will be appreciated! Ty

Bohdan
  • 362
  • 1
  • 5
  • 11
  • 2
    Does this answer your question? [How to check if folder is empty with Python?](https://stackoverflow.com/questions/49284015/how-to-check-if-folder-is-empty-with-python) – rosa b. May 30 '22 at 20:43

1 Answers1

0

I'd do

if len(os.listdir(’path/to/your/folder’)) == 0:
    print("empty")
FluxedScript
  • 2,627
  • 5
  • 17
  • 33
Elias
  • 9
  • 2