import arcgisscripting, os gp = arcgisscripting.create(9.3) gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") gp.workspace = "C:\\junk\\temp.gdb" # Path to your file geodatabase # Get a list of feature classes in the workspace. fcs = gp.ListFeatureClasses() for fc in fcs: str_length =len(fc) new_str_len=str_length -7 new_fc =fc[0:new_str_len] gp.rename_management(fc,new_fc)
import arcgisscripting, os gp = arcgisscripting.create(9.3) gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") gp.workspace = "C:\\path_to_your\\geodatabase.gdb" # Get a list of feature classes in the workspace. fcs = gp.ListFeatureClasses() for fc in fcs: gp.rename_management(fc, fc[:-7])
import arcgisscripting, os gp = arcgisscripting.create(9.3) gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") gp.workspace = "X:\\assr\\carto\\process_temp\\Demo_data.gdb" # Path to your file geodatabase # Get a list of feature classes in the workspace. fcs = gp.ListFeatureClasses() for fc in fcs: str_length = len(fc) # Get the length of the feature class name string new_str_len = str_length - 7 # Get the length minus the last 7 characters new_fc = fc[0:new_str_len] # Builds the new string to the new length gp.rename_management(fc, new_fc) # Rename the feature class
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.