Python vs. Ruby (and os.path.walk)

Tim Roberts timr at
Wed Aug 14 08:36:14 CEST 2002

Kristian Ovaska <kristian.ovaska at> wrote:
>Getting directory listings is almost completely an OS issue. I wrote a
>Python script that calculates the size of a directory tree, and found
>performance bad on large trees. I wrote a C version - and it was
>slower than Python!
>On Windows 98/Me, listdir is not very fast. I don't know about
>NT/2000. I have an old Pascal version that calls DOS interrupts
>directly, and it is 10 times faster than any method I have found on
>Windows. Just not very portable, and it doesn't understand long
>filenames, of course.

Implementing os.path.walk with win32api.FindFiles produces a significant
speed improvement over os.listdir.  I will post such a routine later in the
- Tim Roberts, timr at
  Providenza & Boekelheide, Inc.

More information about the Python-list mailing list