Remove geoprocessing history with python?

05-19-2022 03:08 PM
Occasional Contributor II

Following up on the thread from mid-2018.

When producing public-facing datasets we delete the item's geoprocessing history. Several of these datasets are finalized with script tools. I would like to add a final step of removing geoprocessing history at the end of these tools, so I don't have to do so manually. Is this possible?

It might be contradictory, since the act of removing said geoprocessing history is a geoprocessing operation, but I would like to know if I should give up hope of trying. 

0 Kudos
2 Replies
MVP Frequent Contributor

If you are refereeing to the history in the metadata of the feature class itself, I have done that with ArcMap, but not Pro, as the ArcMap script is still working. 

I followed these procedures (the script works on FC's, the Transformation tool at the bottom removes from the database level.  I incorporated both into a single script.

Now, most all of my scripts have arcpy.SetLogHistory(False) set initially, and that keeps any other geoprocessing operations from logging the history. (resolves you contradiction).

Have not tested, but believe that is equivalent to arcpy.SetLogMetadata(False) in Pro and the LogHistory controls external log files (so, I'd set both to false).


0 Kudos
Occasional Contributor II

@RhettZufelt I am referring to the history in the metadata of the feature class. 

This is indeed very possible in ArcMap. I have an tool in ArcCatalog that clears it. This is fine if it remains the solution, but I'm hoping to do something different.

I would like to still log geoprocessing history, as it's helpful generally. But for the datasets that we produce for public consumption we want to make sure that's cleaned out of the metadata. We have several tools that were built for ArcMap/ArcCatalog that I'm in the process of updating for use in Pro and I would like to be able to tack on at the end of the script the ability to clear metadata, so the output is truly finished. 

0 Kudos