# Python program to check if # a directory contains file import os # directoryPath = "Copy_Gallery" # for root, dirs, files in os.walk(directoryPath): # for name in files: # f = os.path.join(root, name) # print(type(f)) # # if len(f)==568: # # print("none") # # else: # # print("yes") # Python program to check whether # the directory empty or not import os # path of the directory path = "Copy_Gallery" # Getting the list of directories dir = os.listdir(path) # Checking if the list is empty or not if len(dir) == 0: print("Empty directory") else: print("Not empty directory") import glob from os import listdir for f in glob.glob("Copy_Gallery/*"): if len(os.listdir(f))==0: print("file not found") else: print("file found")