[Tutor] Directory not empty :: Fast mode

Jonas Melian jonasmg at softhome.net
Mon May 16 19:30:33 CEST 2005


To knowing if a directory isn't empty, I use:

dir_example = "/usr/foo/"

if glob.glob(os.path.join(dir_example, "*")):
    ...


But, as it has to expand all files, i'm supposed that it's a little slow
to simply knowing if a directory is empty.

Any improvement?


More information about the Tutor mailing list