I am trying to write a script that identifies all Shapefiles within my folder structure and write a list of the .shp files with their full path file name to a newly created .txt file. I was able to get this code to work with PNG files but when i try to search for .shp files i get a RuntimeError. I have every idea this is because there are multiple files that make up a shapefile. Is there a way to do this using arcpy?
His is my code so far:
import os, arcpyStartDir = "C:/Temp/"OutputFileName = "CarolinasSHPs"tempName = StartDir + OutputFileName + ".txt"outFile = open(tempName, 'w')for root, dirs, files in os.walk(StartDir): for f in files: arcpy.env.workspace = root if f.endswith(".shp"): outFile.write( root + f + '\n' )outFile.close()
أكثر...
His is my code so far:
import os, arcpyStartDir = "C:/Temp/"OutputFileName = "CarolinasSHPs"tempName = StartDir + OutputFileName + ".txt"outFile = open(tempName, 'w')for root, dirs, files in os.walk(StartDir): for f in files: arcpy.env.workspace = root if f.endswith(".shp"): outFile.write( root + f + '\n' )outFile.close()
أكثر...