Solved! Go to Solution.
#. Using ArcGIS Desktop, create a new File Geodatabase (for eg output.gdb) on any location. #. Open the script in an editor and edit the path like the following example: input_gdb = r'C:\temp\input.geodatabase' output_gdb = r'C:\temp\output.gdb' #. Run Script: #!/usr/bin/python # Import sys, getopt, arceditor, arcpy modules import sys, getopt, arcpy def main(argv): input_gdb = r'C:\temp\input.geodatabase' output_gdb = r'C:\temp\output.gdb' try: opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="]) except getopt.GetoptError: print 'test.py -i <input_gdb> -o <input_gdb>' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'test.py -i <input_gdb> -o <output_gdb>' sys.exit() elif opt in ("-i", "--ifile"): input_gdb = arg elif opt in ("-o", "--ofile"): output_gdb = arg print 'Input gdb is: "', input_gdb print 'Output gdb is: "', output_gdb Temp_xml = "temp.xml" # Delete the xml workspace document if it exists. arcpy.Delete_management(Temp_xml) # Export XML Workspace Document arcpy.ExportXMLWorkspaceDocument_management(input_gdb, Temp_xml, "DATA", "BINARY", "METADATA") # Import XML Workspace Document. This assumes that the outputfile geodatabase is EMPTY. arcpy.ImportXMLWorkspaceDocument_management(output_gdb, Temp_xml, "DATA", "") # Delete the xml workspace document if it exists. arcpy.Delete_management(Temp_xml) if __name__ == "__main__": main(sys.argv[1:])
#. Using ArcGIS Desktop, create a new File Geodatabase (for eg output.gdb) on any location. #. Open the script in an editor and edit the path like the following example: input_gdb = r'C:\temp\input.geodatabase' output_gdb = r'C:\temp\output.gdb' #. Run Script: #!/usr/bin/python # Import sys, getopt, arceditor, arcpy modules import sys, getopt, arcpy def main(argv): input_gdb = r'C:\temp\input.geodatabase' output_gdb = r'C:\temp\output.gdb' try: opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="]) except getopt.GetoptError: print 'test.py -i <input_gdb> -o <input_gdb>' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'test.py -i <input_gdb> -o <output_gdb>' sys.exit() elif opt in ("-i", "--ifile"): input_gdb = arg elif opt in ("-o", "--ofile"): output_gdb = arg print 'Input gdb is: "', input_gdb print 'Output gdb is: "', output_gdb Temp_xml = "temp.xml" # Delete the xml workspace document if it exists. arcpy.Delete_management(Temp_xml) # Export XML Workspace Document arcpy.ExportXMLWorkspaceDocument_management(input_gdb, Temp_xml, "DATA", "BINARY", "METADATA") # Import XML Workspace Document. This assumes that the outputfile geodatabase is EMPTY. arcpy.ImportXMLWorkspaceDocument_management(output_gdb, Temp_xml, "DATA", "") # Delete the xml workspace document if it exists. arcpy.Delete_management(Temp_xml) if __name__ == "__main__": main(sys.argv[1:])