3

Individually I will Export the gdb to XML Workspace then import that into the personnel geodatabase and all Domains go over fine. But...

Let's Say I have several file geodatabase in a folder and Each of the file geodatabase has 1 feature dataset name "URS" and rest are feature classes. "URS" Feature dataset has several feature class as well.

The task for me is to convert Multiple file geodatabase into multiple Personnel geodatabase without including "URS" Feature datasets. If the Geodatabase don't have "URS" Feature dataset or any other feature classes then the python program will create an empty personnel geodatabase.

I am using pyscripter and below mentioned concept is not workin for a single geodatabase. How can I convert multiple File geodatabase (.gdb) into multiple Personal geodatabase (.mdb)?

# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "I:\python\Multiplegdb"
print arcpy.env.workspace
# Set local variables
inFeatures = r'I:\python\Multiplegdb\ABC.gdb'
print inFeatures
outLocation = r'I:\python\Multiplegdb\ABC_Output.mdb'
print outLocation
# Execute TableToGeodatabase
arcpy.FeatureClassToGeodatabase_conversion(inFeatures, outLocation)

enter image description here

enter image description here

Aaron
52k30 gold badges161 silver badges326 bronze badges
asked Apr 17, 2015 at 22:02
8
  • 1
    Welcome to GIS SE! As a new user be sure to take our Tour. As it stands I think your question is too broad for our focussed Q&A format because it seems to be simply stating your problem and then asking for "input or code in python". I recommend that you edit your question to say precisely what you have tried and where you are stuck because we are not a code writing service. Commented Apr 17, 2015 at 22:21
  • When you say "personnel geodatabases", do you mean personal (*.mdb) geodatabases? Commented Apr 17, 2015 at 23:22
  • Yes.....Can you please remove a hold on my question Commented Apr 19, 2015 at 13:23
  • Do you need the feature classes contained within the "URS" feature dataset to transfer to the output personal geodatabase? Commented Apr 19, 2015 at 13:35
  • hello Aaron,No I don't need URS feature dataset in the .mdb. I wanted to export all individual .gdb's to individual .mdb's and the .mdb name will be same as .gdb. Commented Apr 19, 2015 at 20:54

1 Answer 1

2

Here is one approach that performs the following actions:

  1. Create a new .mdb with old FGDB name, but in new workspace
  2. Find all FC's in FGDB--take into account empty FDS's
  3. Copy all FC's to .mdb

import arcpy, os
arcpy.env.workspace = r'C:\temp\inws'
inws = arcpy.env.workspace
outws = r'C:\temp\outws'
fgdb = arcpy.ListWorkspaces(workspace_type = "fileGDB")
counter = 1
for f in fgdb:
 # Define the output .mdb name
 name = os.path.basename(f).split(".")[0]
 # Create a new personal gdb (.mdb)
 arcpy.CreatePersonalGDB_management(outws, name)
 outgdb = os.path.join(outws, name + ".mdb")
 # Get the FC's in FDS and copy to .mdb
 arcpy.env.workspace = os.path.join(inws, f, "")
 fcs1 = arcpy.ListFeatureClasses()
 for fc in fcs1:
 arcpy.CopyFeatures_management(fc, os.path.join(outgdb, fc))
 # Get stand-alone FC's and copy to .mdb
 arcpy.env.workspace = os.path.join(inws, f, "URS")
 fcs2 = arcpy.ListFeatureClasses()
 # Make sure there are FC's in the FDS
 if fcs2 != None:
 for fc in fcs2:
 arcpy.CopyFeatures_management(fc, os.path.join(outgdb, fc))
 print "%s of %s workspaces converted" % (counter, len(fgdb))
 counter = counter + 1
print "Processing complete."
answered Apr 19, 2015 at 14:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.