Trying to go through every folder on a drive, count the number of files in each folder and if the number of files is greater than or equal to 3, increment a count. Should be easy right? Well I've completely borked it and I'm at a loss.
import os, os.path, sys
rootdir = 'q:'
documentedcount = 0
for root, subFolders, files in os.walk(rootdir):
filecount = len([name for name in os.listdir('.') if os.path.isfile(name)])
print "Filecount = %s" % filecount
if filecount >= 3:
documentedcount =+1
print "Documented in the loop is %s" % documentedcount
print "Documented = %s" % documentedcount
It doesn't want to go beyond the root directory and into any of the subfolders. It's driving me nuts because this should be simple as hell but I just can't seem to wrap my head around it.