Skip to content

Instantly share code, notes, and snippets.

@NathanW2
Last active April 23, 2019 18:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NathanW2/4577289 to your computer and use it in GitHub Desktop.
Save NathanW2/4577289 to your computer and use it in GitHub Desktop.
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