[GIS] Deleting ArcGIS Project created using ArcGIS Pro

arcgis-prodeleteerror-000464project-pane

I have deleted a few ArcGIS Projects, created using ArcGIS Pro, by using Windows Explorer to delete the folder that contains them.

However, I thought that, as long as the project (not the current project) was not already open somewhere else, then it may have been possible to use the Project pane to delete it.

I added a folder connection in the Project pane to a folder above the project that I wanted to delete but when I right-clicked on the project there is no Delete option offered (and hitting the Delete key while it is highlighted does nothing either).

Is the recommended way to delete an ArcGIS Project (created using ArcGIS Pro) simply to use Windows Explorer to delete its folder?

Some research and results subsequent to asking this question appears below.

When I tried to use the Delete tool from the Geoprocessing pane to delete a project (not the one open, nor one that had been used in the session, but one that could be easily deleted from Windows Explorer after closing ArcGIS Pro) it resulted in an error:

ERROR 000464: Cannot get exclusive schema lock. Either being edited
or in use by another application. Failed to execute (Delete).

enter image description here

The other complication is that using Windows Explorer works fine for deleting a project for which a folder was created but, when that checkbox is not chosen at the time of project creation, the project parts can be placed in an existing folder amongst many other files and subfolders. I thought there might be something that would use the *.aprx to identify and delete its project parts.

I don't yet understand the use case for when you would want to leave that checkbox unticked and potentially have multiple projects "free-floating" in a single folder. Until/unless I do, I'll be recommending to always leave the checkbox ticked and to delete project folders using Windows Explorer.

Best Answer

If you need to do this in code, use shutil.rmtree. File management is the file manager/standard library's job.

Related Question