Is there an alternative to os.walk?
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Wed Oct 4 19:53:25 CEST 2006
> Hi all,
> I have a question about traversing file systems, and could use some
> help. Because of directories with many files in them, os.walk appears
> to be rather slow.
Provide more info/code. I suspect it is not os.walk itself that is slow,
but rather the code that processes its result...
> I`m thinking there is a potential for speed-up since
> I don`t need os.walk to report filenames of all the files in every
> directory it visits. Is there some clever way to use os.walk or another
> tool that would provide functionality like os.walk except for the
> listing of the filenames?
You may want to take a look at os.path.walk then.
More information about the Python-list