Permanently deletes data from disk. All types of geographic data supported by ArcGIS, as well as toolboxes and workspaces (folders and geodatabases), can be deleted. If the specified item is a workspace, all contained items are also deleted.
Data currently in use in another ArcGIS application cannot be deleted—the tool fails with ERROR 000464.
Deleting a shapefile also deletes ancillary files such as the metadata, projection, and index files.
Deleting a folder moves the folder to the system Recycle Bin, where it can be restored or permanently deleted.
Feature classes and tables participating in a network analysis dataset or a topology cannot be deleted.
Deleting a mosaic dataset will only delete the mosaic dataset. To delete a mosaic dataset in its entirety, including any tables in the database and, optionally, any overviews or caches created with it use the Delete Mosaic Dataset tool.
Deleting a database connection file does not delete the enterprise database. A database connection file is simply a shortcut to the database.
Deleting a relationship class deletes the row corresponding to that relationship from the relationship table.
Starting in ArcGIS Pro 2.6, the Delete tool can be used to delete multiple items.
The input data to be deleted.
|Data Element; Graph; Layer; Table View; Utility Network|
The type of data on disk to be deleted. This is only necessary when the input data is in a geodatabase and naming conflicts exist, for example, if the geodatabase contains a feature dataset and a feature class with the same name. In this case, the data type is used to clarify which dataset to delete.
Whether the delete was successful.
The following Python window script demonstrates how to use the Delete function in immediate mode.
import arcpy arcpy.env.workspace = "C:/data" arcpy.Copy_management("majorrds.shp", "majorrdsCopy.shp") arcpy.Delete_management("majorrdsCopy.shp")
The following Python script demonstrates how to use the Delete function in a stand-alone script.
# Name: Delete_Example2.py # Description: Delete majorrdsCopy.shp # Import system modules import arcpy # Set workspace arcpy.env.workspace = "C:/data" # Set local variables in_data = "majorrds.shp" out_data = "majorrdscopy.shp" # Execute Copy arcpy.Copy_management(in_data, out_data) # Execute Delete arcpy.Delete_management(out_data)
The following Python window script demonstrates how to use the Delete function with multiple inputs in immediate mode.
import arcpy arcpy.env.workspace = r"C:\dataToDelete" arcpy.management.Delete(r"'NIRrG_ps8.afr';'redlands.tpkx';'colormap.img'")
- Basic: Yes
- Standard: Yes
- Advanced: Yes