I'm wanting to make a copy of a geodatabase from one location on our network to another. Can anyone help?
Thanks for the help. Below is my final script I came up with that has been tested and works.
<SPAN class="keyword token">import</SPAN> arcpy <SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN> env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"M:\GIS Geodatabases"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Copy_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Cadastral.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> r<SPAN class="string token">"T:\pl\Planning Geodatabases\Cadastral.gdb"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Cadastral.gdb Copy Complete"</SPAN> env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"M:\GIS Geodatabases"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Copy_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Transportation.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> r<SPAN class="string token">"T:\pl\Planning Geodatabases\Transportation.gdb"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Transportation.gdb Copy Complete"</SPAN> env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"M:\GIS Geodatabases"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Copy_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"AdminBoundaries.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> r<SPAN class="string token">"T:\pl\Planning Geodatabases\AdminBoundaries.gdb"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"AdminBoundaries.gdb Copy Complete"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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...
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.
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....
I started writing out some code, but check this: Copy—Help | ArcGIS Desktop it's pretty easy...
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.