How To: Batch delete features after running a process in ModelBuilder
When running geoprocessing tools in ModelBuilder, sometimes intermediate features not required for the analysis must be removed. Deleting unnecessary features can save machine storage space and clear the workspace from clutter. However, it is not possible to manually batch delete features in the Catalog window. It is also time-consuming to delete features manually especially if many features are involved.
Choose one of the following methods to batch delete features, depending on the need.
Use the Delete Intermediate Data function
To delete unnecessary feature classes after running a model in ModelBuilder, click the Model menu and click Delete Intermediate Data. Check if the data is deleted in the Catalog window.
Use the Iteration and Delete tools
If it is necessary to delete some intermediate features, use the Iteration and Delete tools in the ModelBuilder window. After running a process in ModelBuilder, open a new ModelBuilder window and insert the Iterate Feature Classes and Delete tools.
- Save the output of the process that must be deleted with a keyword appended to the output name. For example, _delete.
- Open a new ModelBuilder window .
- Click Insert > Iterators > Feature Classes.
- Search for the Delete tool and insert the tool into the new ModelBuilder window with the Iterate Feature Classes tool.
- Double-click the Iterate Feature Classes feature and set the parameters:
- Workspace or Feature Dataset: Select the geodatabase containing the features to be deleted.
- Wildcard: Type *delete to delete features with the keyword _delete in the name as specified in step 1.
- Feature Type: Leave feature type as blank to select all the item types in the geodatabase.
Note: For more information on the parameters in the Iterate Feature Classes tool, refer to Iterate Feature Classes.
- Double-click the Delete feature and set Input Data Element to the output from Iterate Feature Classes.
- Run the model. The selected features are deleted from the geodatabase.