arcpy.CopyFeatures_management(path, "K:/COUNTY_MUKEY/IA.gdb/"+base.rstrip(".shp"))
Looks like you missed a slash after IA.gdb/arcpy.CopyFeatures_management(path, "K:/COUNTY_MUKEY/IA.gdb/"+base.rstrip(".shp"))
Any ideas on how to get a list of arcinfo coverages and personal/file geodatabases as well?
Thank you in advance.
# For each ws, print the fc's and tbl's. for ws in arcpy.ListWorkspaces("*", "FileGDB"): arcpy.env.workspace = ws # feature classes for fc in arcpy.ListFeatureClasses(): print fc # tables for tbl in arcpy.ListTables(): print tbl # feature classes in datasets for ds in arcpy.ListDatasets(): arcpy.env.workspace = ds for dfc in arcpy.ListFeatureClasses(): print dfc
import arcgisscripting
import sys
import fileinput
import os
import string
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1
dbfFileA = "c:\\d_drive\\temp\\listFC.dbf"
#insert cursor
#
rows = gp.InsertCursor(dbfFileA)
try:
for root, dirs, files in os.walk("K:/fish/chpp"):
for file in files:
if file.endswith(".shp") or file.endswith(".mdb"):
path = os.path.abspath(os.path.join(root, file))
#print path
row = rows.NewRow()
row.Name = os.path.basename(path)
row.Location = path
rows.InsertRow(row)
del rows
print "successful"
except:
print "Error"
print gp.getmessages()
for dir in os.listdir(''): if os.path.isdir(dir): # prj.adf seem to occur in every "coverage". if os.path.exists(dir+"/prj.adf"): print " Creating "+dir+".e00 from "+dir+"..." gp.Export_arc("COVER", dir, dir+".e00") gp.GetMessages()
import arcgisscripting import sys import fileinput import os import string gp = arcgisscripting.create(9.3) gp.OverWriteOutput = 1 dbfFileA = "c:\\d_drive\\temp\\listFC.dbf" #insert cursor # rows = gp.InsertCursor(dbfFileA) try: for root, dirs, files in os.walk("C:/D_Drive/temp"): for file in files: if file.endswith(".shp"): #print "a" path = os.path.abspath(os.path.join(root, file)) #print path row = rows.NewRow() row.Name = os.path.basename(path) row.Location = path row.Directory = os.path.basename(os.path.dirname(path)) row.Type = "Shapefile" rows.InsertRow(row) elif file.endswith("gdb"): #print "1" path = os.path.abspath(os.path.join(root, file)) #print path row = rows.NewRow() #row.Name = os.path.dirname(path) row.Name = os.path.basename(os.path.dirname(path)) #row.Name = "gdb" row.Location = os.path.dirname(path) row.Directory = os.path.basename(os.path.dirname(path)) row.Type = "File Geodatabase" rows.InsertRow(row) elif file.endswith(".mdb"): #print "3" path = os.path.abspath(os.path.join(root, file)) #print path row = rows.NewRow() row.Name = os.path.basename(path) row.Location = path row.Directory = os.path.basename(os.path.dirname(path)) row.Type = "Personal Geodatabase" rows.InsertRow(row) elif file.endswith("prj.adf"): #print "4" path = os.path.abspath(os.path.join(root, file)) row = rows.NewRow() row.Name = os.path.basename(os.path.dirname(path)) row.Location = os.path.dirname(path) row.Directory = os.path.basename(os.path.dirname(path)) row.Type = "ArcInfo Coverage" rows.InsertRow(row) del rows print "successful" except: print "Error" print gp.getmessages()