The XSLT Transformation tool can be used with the transformation file "Delete metadata geoprocessing history" to zap the GP history from the metadata record.
XSLT Transformation—Help | ArcGIS for Desktop
I realize this is late in the game, but Curtis' info helped me find the right help article. I was able to write a Python script to delete both the geoprocessing history and machine name/local info, using the XSLTransform tool. This script takes a file geodatabase as input, iterates through all the feature classes and performs the transformation. I used a file geodatabase as the workspace instead of the SDE environment indicated in the help article. Hope this helps someone!
EDITED If you are doing both gp history and machine name transforms as below, you have to do the XSLTransform, then import, before the second XSLTransform/import or the gp history is added back in. Code edited to reflect this.
import os, sys, shutil
# set environments & variables
arcpy.env.workspace = fgdb
# the below construction makes it installation independent
installDir = arcpy.GetInstallInfo()['InstallDir']
ssPath1 = 'Metadata\\Stylesheets\\gpTools\\remove geoprocessing history.xslt'
ssPath2 = 'Metadata\\Stylesheets\\gpTools\\remove local storage info.xslt'
xsltPath1 = installDir + ssPath1
xsltPath2 = installDir + ssPath2
outXml = 'c:\\XML_out'
# iterate through feature classes in file geodatabase
# remove geoprocessing history and local machine name/paths
for fc in arcpy.ListFeatureClasses():
nameXml1 = outXml + os.sep + str(fc) + ".xml"
nameXml2 = outXml + os.sep + str(fc) + "2.xml"
arcpy.XSLTransform_conversion(fgdb + os.sep + fc, xsltPath1, nameXml1,"")
arcpy.MetadataImporter_conversion(nameXml1, fgdb + os.sep + fc)
arcpy.XSLTransform_conversion(fgdb + os.sep + fc, xsltPath2, nameXml2,"")
arcpy.MetadataImporter_conversion(nameXml2, fgdb + os.sep + fc)
print("Succeeded: XSLTransform for " + str(fc))
except Exception as e:
print("Failed: " + str(e))
# clean up
if __name__ == '__main__':
This is great, @HeatherW. I've taken your code and encapsulated it in a Python toolbox (.pyt) for ease of use within ArcCatalog. I added some functionality, too:
Glad to hear it was helpful Noel Peterson! Thanks for extending it and making it available. I am watching the Pro Road Map to see when the arcpy metadata tools will be supported in Pro.
Retrieving data ...