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 file
import os, glob # Delete all files that contain the word 'points' for file in glob.glob("*points*"): os.remove(file)
import os ws = "c:/temp" for file in os.listdir(ws): if file.endswith(".shp"): print file
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()
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.