waling a directory with very many files

Diez B. Roggisch deets at nospam.web.de
Mon Jun 15 08:15:25 EDT 2009


tom wrote:

> i can traverse a directory using os.listdir() or os.walk(). but if a
> directory has a very large number of files, these methods produce very
> large objects talking a lot of memory.

if we assume the number of files to be a million (which certainly qualifies
as one of the larger directory sizes one encounters...), and the average
filename length with 20, you'd end up with 20 megs of data. 

Is that really a problem on nowadays several gigabyte machines? And we are
talking a rather freakish case here.

Diez



More information about the Python-list mailing list