frederic12

convert FeatureClasses(shape) to SDE gdb after save to.lyr in the same folder

Discussion created by frederic12 on Nov 24, 2011
List FeatureClasses(shape) then covert to SDE gdb after save to.lyr

thanks jsKins, it's working this script now.
So another question, about lyr; so my question is : when i export the shapefiles of my folderX(with subfloders) to geodatabase SDE, i want to save a file .lyr in myfolderX (their sub folder source) with this code python.


try:
def fcs_in_workspace(workspace):
arcpy.env.workspace = workspace
for fc in arcpy.ListFeatureClasses():
print os.path.join(workspace, fc)
arcpy.FeatureClassToGeodatabase_conversion(fc, r"C:\\\\Documents and Settings\\xx\\Application Data\\ESRI\\Desktop10.0\\ArcCatalog\\Connection to xx.sde")
for ws in arcpy.ListWorkspaces():
fcs_in_workspace(os.path.join(workspace, ws))
except Exception as e:
print e.message
arcpy.AddError(e.message)



Thanks
Bests Regards

Outcomes