I am trying to list datasets within a directory. I have played with ListDatasets and ListFeatureClasses. These work successfully with geodatabase and CAD layers. How do I construct a Python script that lists shapefiles?
import arcpy # Set workspace environment to a folder arcpy.env.workspace = "c:/temp" # A list of shapefiles arcpy.ListFeatureClasses()
Could this script be expanded to list multiple file types?.
import os
ws = "c:/temp"
for file in os.listdir(ws):
if file.endswith(".shp") or file.endswith(".dxf") or file.startswith("str"):
print fileimport os, glob
# Delete all files that contain the word 'points'
for file in glob.glob("*points*"):
os.remove(file)