AnsweredAssumed Answered

Arcpy: How do I copy FGDBR from multiple file geodatabases into one file geodatabase?

Question asked by IngoWolff_LANUV on Jun 17, 2020
Latest reply on Jun 25, 2020 by IngoWolff_LANUV



I have several thousands of file geodatabases with different FGDBR Datasets I want to identify and copy into a central file geodatabase. Unfortunately my ArcPy skills are not so advanced to get the nested loops to run from one file geodatabase to the next, selecting and copying the FGDBR into my targed file geodatabase.


I started with this code snipped, but it does not find any of my selected FGDBRs. What am I missing?


Any help is greatly appreciated!


import arcpy
from arcpy import env
import os
arcpy.env.overwriteOutput = True
arcpy.env.parallelProcessingFactor = "75%"
#Setting up first directories for source and destination for iterative raster data loop no 1
dir = r"F:\Daten_Wolff\Topographische_Gefaehrdungsanalyse\Test_Source"
arcpy.env.workspace = dir
folder001 = r"F:\Daten_Wolff\Topographische_Gefaehrdungsanalyse\BlueSpot_050.gdb"+ "\\"
gdbList = arcpy.ListWorkspaces('*','FileGDB')
for gdb in gdbList:
arcpy.env.workspace = gdb #--change working directory to each GDB in list
datasetList = arcpy.ListDatasets('*','Raster') #--make a list of all (if any) rastere datasets that exist in current GDB
for dataset in datasetList:
arcpy.env.workspace = dataset #--change working directory to each dataset (if any) in list
for Raster in arcpy.ListRasters('*050*'):
arcpy.env.workspace = dataset
for Raster in arcpy.ListRasters('*050*'):
print("processing raster: %s" %os.path.join("env.workspace",Raster))
outRasterdataset = folder001 + str(Raster.rsplit("_",0)[0])
arcpy.CopyRaster_management (Raster, outRasterdataset, "DEFAULTS", "", "-999", "NONE", "NONE" , "32_BIT_FLOAT", "NONE", "NONE" )