import os, arcpy
arcpy.env.workspace = arcpy.GetParameterAsText(0)
fes = arcpy.ListFeatureClasses()
fsave = arcpy.GetParameterAsText(2)
files = fsave+'/Fields.csv'
fname = open(files, 'wb')
aliasname = 0
shpcount = 0
for fe in fes:
shpcount = shpcount + 1
AliasC = arcpy.ListFields(fe)
if aliasname == 0:
result = 'NAME'
for AliasN in AliasC:
result = result+','+AliasN.name
result = result+'\n'
fname.writelines(result)
aliasname = 1
result = fe
for AliasN in AliasC:
if arcpy.GetParameterAsText(1) == 'LENGTH':
nstr = str(AliasN.length)
elif arcpy.GetParameterAsText(1) == 'TYPE':
nstr = AliasN.type
elif arcpy.GetParameterAsText(1) == 'NAME':
nstr = AliasN.name
result = result+','+nstr
result = result+'\n'
arcpy.AddMessage(result)
fname.writelines(result)
fname.close()
arcpy.AddMessage("Shp Count: "+str(shpcount))
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import arcpy,csv,os
arcpy.env.workspace = arcpy.GetParameterAsText(0)
features = arcpy.ListFeatureClasses()
field = "TYID"
fsave = arcpy.GetParameterAsText(1)
files = fsave+'/CheckTYID.csv'
data =[]
for feature in features:
values = []
rows = arcpy.da.SearchCursor(feature, (field))
for row in rows:
values.append(row[0])
TYID = list(set(values))
data.append((feature.split(".")[0],TYID))
arcpy.AddMessage((feature.split(".")[0],TYID))
with open(files,"wb+") as csvfile:
writer = csv.writer(csvfile)
writer.writerow(["SHP","TYID"])
writer.writerows(data)
arcpy.AddMessage("TYID check has been completed")