Python os.path.isdir () runs slowly on windows

We experience very slow performance with the os.path.isdir () method in windows. The same function under osx works in 0.3 seconds versus 1.8 for windows when checking a large number of files.

Is there an alternative to os.path.isdir () that will be faster?

+4
source share
1 answer

I think the fastest way to check on Windows is to call GetFileAttributes() . You can try this through ctypes and see if this happens faster.

If it's not so fast, you probably just have to suck it. And if it's faster, then you have your own solution.

+1
source

Source: https://habr.com/ru/post/1343834/


All Articles