I have folder 201 and subfolder 202 then some files in the 202 folder. Now i want to check in folder 201 if files exist but it always shows yes as there's sub-folder (202).
201 folder has no files and 202 have 3 files.
There is not a single file folder 201 but below code prints " files found in the directory."
import os
p = r"C:\sample_test\201"
for files in os.walk(p):
if files:
print(p, " files found in the directory.")
if not files:
print(p, " files NOT found in the directory.")