In my SHP to GDB toolbox, I create a list of layers in MXD, then I check for those not broken I move them. Despite using ListBrokenDataSources I have errors like this: Runtime error <type 'exceptions.WindowsError'>: [Error 3] Impossibile trovare il percorso specificato: u'J:\\20120208_Backup_disco_E\\Archivio\\ATLArete\\Shape Atlarete 1-1-2008\\miste.shp'I'm desperate at this point, any help????Following my code:# Create a list of SHP in mxd
list = []
df_list = arcpy.mapping.ListDataFrames (mxd)
for df in df_list:
for fc in arcpy.mapping.ListLayers (mxd, "", df):
if (fc.supports("DATASOURCE")) and (fc.dataSource.endswith(".shp")):
list.append(fc)
print("List created")
# Check for borken datasource
for fc in list:
if arcpy.mapping.ListBrokenDataSources(fc):
list.remove(fc)
print ("Broken data removed from list")
# Move fc to gdb
add_list = []
for fc in list:
fc_date = time.strftime("%Y%m%d", time.gmtime(os.path.getctime(fc.dataSource)))
try:
dsc = arcpy.Describe(fc)
out_temp = '_' + fc_date + '_' + fc.name + '_' + fc_prj
out_name = arcpy.ValidateTableName(out_temp)
print ('Created ' + out_name + ' to ' + gdb_full_path)
except:
out_temp = '_' + fc_date + '_' + fc.name + '_' + 'UNKNOWN'
out_name = arcpy.ValidateTableName(out_temp)
print ('Created ' + out_name + ' to ' + gdb_full_path)
arcpy.FeatureClassToFeatureClass_conversion(fc, fd_path, out_name)
replace_name = fd_path + '\\' + out_name
fc.replaceDataSource (gdb_full_path, "FILEGDB_WORKSPACE", out_name)
print ('Replaced data source ' + out_name + ' in ' + gdb_full_path)
# Create a new MXD
new_mxd = os.path.splitext(gdb_full_path)[0] + '\\' + 'MXD' + '\\' + time.strftime("%Y%m%d", mxd_date )+ '_' + (mxd_name)
mxd.saveACopy(new_mxd)
print ('Created new MXD ' + new_mxd + ' in ' + ws)