Skip to content

Instantly share code, notes, and snippets.

@NathanW2
Last active April 23, 2019 18:04
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
f.endswith('.img'):
desc = arcpy.Describe(root + "\\" + f)
#write info to text file
txt.write(desc.name + "," + 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.name + "," + child.path + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment