os.walk extremely slow - alternatives?

المشرف العام

Administrator
طاقم الإدارة
A pretty general question that doesn't require a snippet... basically my issue is I need to 'walk' a directory tree, which benchmarking has shown if I provide the specific folder, it runs somewhere around 300x faster than using os.walk. Is there some alternative using python 2.7? I understand the issue is that os.walk is executing os.listdir and stat, but can't come up with a syntactically sound solution. It is critical for this automation that I can traverse a directory tree, but the customer will not be satisfied with the result if it takes an hour versus their current workflow which is multiple tools that takes ~3 minutes per tool. The tool is meant to perform multiple geoprocessing operations on shapefiles within the tree, based on wildcard (fnmatch).



أكثر...
 
أعلى