Skip to content

Instantly share code, notes, and snippets.

Last active Apr 23, 2019
What would you like to do?
import os, arcpy
#create blank text file
with open("C:\\Temp\\GISlayers.txt", "w") as txt:
for root, dirs, files in os.walk("C:\\Temp\\temp"):
for f in files:
#look for shapefiles
if f.endswith('.shp') or f.endswith('.lyr') or
desc = arcpy.Describe(root + "\\" + f)
#write info to text file
txt.write( + "," + desc.catalogPath + "\n")
#look for file geodatabases
if f.endswith('.gdb'):
desc = arcpy.Describe(root)
for child in desc.children:
#write info to text file
txt.write( + "," + child.path + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment