Count Files in a Directory

Peter Otten __peter__ at web.de
Mon Dec 22 14:16:42 EST 2003


hokieghal99 wrote:

>     The os thinks there are 12,204 objects in the path while Python
> thinks there are 12,205 objects.

If it's always one more directory then it could be the initial directory
setpath (ugly name, by the way) that is counted by the os but not by your
function. To fix it, you could initialize 

dir_count = 1 # instead of 0

Peter




More information about the Python-list mailing list