I have some feature classes with attachments in personal geodatabase . I want to copy these from personal to file geodatabase automatically using arcpy. I used the code suggested by @Aaron to copy all feautre classes and datasets to file geodatabase.It was great But i couldn't copy attachments using the code.How can i copy the attachments to file gdb using arcpy?

  • Please post your code. – Chad Cooper Aug 16 '15 at 0:15

I have assumed following:

  1. For your feature-classes in mdb, "_ATTACH" suffix is used for only attachment table.
  2. You can further customize this code.
  3. This code needs to be run after all featureclasses (except attachment tables- this script will create attachment table and load relationship classes from the respective table from the mdb into gdb) are moved from mdb to gdb .
  4. It is tested in arcmap 10.3.

    mdb_folder = r'C:\Users\USER_NAME\Documents\ArcGIS\gissta'
    gdb_folder = r'C:\Users\USER_NAME\Documents\ArcGIS\Default.gdb'
    tables_paths = []
    tables_names = []
    #get all attachement tables in the mdb. 
    for w,d,f in arcpy.da.Walk(mdb_folder):
        for i in f:
            if i.endswith("__ATTACH"):
    #get all featureclasses have attachment tables in the **gdb** then create those tables in gdb and load data in them. 
    for w,d,f in arcpy.da.Walk(gdb_folder):
        for i in f:
            if i in [j.replace("__ATTACH","") for j in tables_names]:
                pth = os.path.join(w,i)
                tbl = pth+"__ATTACH"
                for k in tables_paths:
                    print k
                    if i in k:
                        arcpy.Append_management(inputs=k, target=tbl, schema_type="TEST", field_mapping="", subtype="")
  • Do you have any updates? If i have been of use in your help. – SIslam Aug 17 '15 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.