How do I copy a geodatabase to a different location using arcpy?

7091
5
Jump to solution
07-30-2018 03:03 PM
by Anonymous User
Not applicable

I'm wanting to make a copy of a geodatabase from one location on our network to another. Can anyone help?

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Thanks for the help. Below is my final script I came up with that has been tested and works.

import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True

env.workspace = r"M:\GIS Geodatabases"
arcpy.Copy_management("Cadastral.gdb", r"T:\pl\Planning Geodatabases\Cadastral.gdb")

print "Cadastral.gdb Copy Complete"

env.workspace = r"M:\GIS Geodatabases"
arcpy.Copy_management("Transportation.gdb", r"T:\pl\Planning Geodatabases\Transportation.gdb")

print "Transportation.gdb Copy Complete"

env.workspace = r"M:\GIS Geodatabases"
arcpy.Copy_management("AdminBoundaries.gdb", r"T:\pl\Planning Geodatabases\AdminBoundaries.gdb")

print "AdminBoundaries.gdb Copy Complete"

View solution in original post

0 Kudos
5 Replies
JoeBorgione
MVP Emeritus

I started writing out some code, but check this: Copy—Help | ArcGIS Desktop   it's pretty easy...

That should just about do it....
by Anonymous User
Not applicable

Thanks for the help. Below is my final script I came up with that has been tested and works.

import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True

env.workspace = r"M:\GIS Geodatabases"
arcpy.Copy_management("Cadastral.gdb", r"T:\pl\Planning Geodatabases\Cadastral.gdb")

print "Cadastral.gdb Copy Complete"

env.workspace = r"M:\GIS Geodatabases"
arcpy.Copy_management("Transportation.gdb", r"T:\pl\Planning Geodatabases\Transportation.gdb")

print "Transportation.gdb Copy Complete"

env.workspace = r"M:\GIS Geodatabases"
arcpy.Copy_management("AdminBoundaries.gdb", r"T:\pl\Planning Geodatabases\AdminBoundaries.gdb")

print "AdminBoundaries.gdb Copy Complete"
0 Kudos
JoeBorgione
MVP Emeritus

Good job; you only need to set your workspace once, so lines 10 & 14 aren't needed. If you want to have some fun, create a list of the the database names and iterate through them in a 'for' loop....

That should just about do it....
0 Kudos
by Anonymous User
Not applicable

I'm pretty new to Python but thanks for the input. I will have to give that a try so I can sharpen my skills.

0 Kudos
JoeBorgione
MVP Emeritus

Stick with it and have some fun.  Anytime you need to do something more than a couple of times, script it.  There is only one way to get into python, and that's to get into python!  A year ago I couldn't spell python...

That should just about do it....