count files import os outpath = './0/' j = 0 for file in os.listdir(outpath): if os.path.isfile(os.path.join(outpath,file)): j += 1