I am trying to check if a folder is empty and do the following:
import os
downloadsFolder = '../../Downloads/'
if not os.listdir(downloadsFolder):
print "empty"
else:
print "not empty"
Unfortunately, I always get "not empty" no matter if I have any files in that folder or not. Is it because there might be some hidden system files? Is there a way to modify the above code to check just for not hidden files?
print os.listdir(downloadsFolder)
?