Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- import os
- #Set parent directory
- arcpy.env.workspace = r'C:Folder1'
- #List the subfolders in the parent directory
- workspaces = arcpy.ListWorkspaces("*", "Folder")
- for workspace in workspaces:
- #Set new environment to list workspaces
- arcpy.env.workspace = workspace
- fgdbs = arcpy.ListWorkspaces("*", "FileGDB")
- #Iterate through each FileGDB contained within and copy to destination
- for fgdb in fgdbs:
- #parsing the name from the full path of each FGDB
- #name = os.path.basename(fgdb).rstrip(os.path.splitext(fgdb)[1])
- name = os.path.basename(fgdb)[:-4]
- arcpy.Copy_management(fgdb, "C:/Folder1Copy/{0}.gdb".format(name))
Add Comment
Please, Sign In to add comment