I'm having an issue where calling
arcpy.ListFeatureClasses() in a workspace with 400 shapefiles takes a very long time (more than 10 minutes).
os module to achieve the same effect takes less than a second:
import os allSingleNonRoadPolys =  for file in os.listdir(r'D:\data\allSingleNonRoadPolys'): if file.endswith(".shp"): print(file) allSingleNonRoadPolys.append(file)
You can then achieve the same effect as
ListFeatureClasses by simply prepending the workspace to the filename, each time you need to use a dataset, as seen here:
for shp in allSingleNonRoadPolys: arcpy.someTool(workspace + '\\' + shp)
Why would I even keep using
ListFeatureClasses() and what makes it take so long? Does it do anything incredibly useful that cannot be achieved in any other way?