Check Filesize Function Always Returns True

1 day ago 1
ARTICLE AD BOX

I'm trying to get this function to return False if the file size is 0 (file is empty) or True if filesize is greater than 0 (file is not empty) but it always returns True. What am I doing wrong here?

import os import glob mypath = "/home/Downloads/" d = {} def step1(): command = ''.join([mypath, "/**/*.nfo"]) for file in glob.glob(command, recursive=True ): if os.path.getsize(file) == 0: return False else: return True print (step1())
Read Entire Article