Zipping a shapefile via ArcToolbox

I’ve received a request on how to use the Zip Shapefile code I posted last week from ArcGIS. Sorry, I did not set the code up to call directly from ArcGIS but only as an illustration of how it can be done.

I have, however, with some minor tweaking, made a version that can added to ArcToolbox. The steps to install are below, please note that at one point I had you download a *.zip file that had been renamed to *.jpg–this should now be corrected and the link should lead you directly to  Because of this steps two and three are obsolete.

1) Download the code from here.
2) Rename the file from zipshapefile-zip.jpg back to
3) Unzip the file.
4) Move to C:\Program Files\ArcGIS\ArcToolBox\Scripts\
5) Optionally, move Zip Shapefile.tbx, perhaps C:\Program Files\ArcGIS\ArcToolBox\Toolboxes.
6) Add the toolbox to ArcToolbox. ESRI has instructions here on how to do this.

You should now have a new toolbox named “Zip Shapefile” with a script named “Zip a Shapefile” in it. Clicking on on the tool will bring up this dialog.

In response to Chris:

I believe you need to copy the file from the .zip that you downloaded to C:\Program Files\ArcGIS\ArcToolBox\Scripts\, the error message is consistent with the tool not being about to find the python script there.

If you prefer to place the in a different location, you will need to change the source on the tool. To do this, right click on the tool in ArcCatalog and change the path of the Script File as set in the Source tab (see below):


4 thoughts on “Zipping a shapefile via ArcToolbox

  1. This script is a great idea – I’ve been trying to use it and I keep getting this error:

    ERROR 000576: Script associated with this tool does not exist.
    Failed to execute (ZipShapefile).
    Failed at Mon Mar 12 11:12:23 2012 (Elapsed Time: 0.00 seconds)

    Any ideas? I followed your instructions and things seemed to be working, but at the final step things seem to fail.

    • Chris, please see the addition I made to the post (I wanted to include an image, which is not allowed in a reply). I suspect that the file is not in the expected location ( C:\Program Files\ArcGIS\ArcToolBox\Scripts\ ).

      • I got it to run, but unsuccessfully, got a permission error:

        : [Errno 13] Permission denied: ‘h:\\boty 2534\\livlab\\’
        Failed to execute (ZipShapefile).

        Any ideas? Probably a local error, but seems like I should have permission…

      • Paul,

        Looks like another user (using machine N00024747) has the shapefile open (or had it open & ArcGIS left the .lock file) as you were trying to zip it. You probably have full os access to the rest of the shapefile, just not the .lock file which is used by ArcGIS 10 to prevent multiple people from editing a shapefile at the same time. You probably will need to wait for the other user to stop working with the file or use an admin account to delete the .lock file if it was left from an aborted/crashed ArcApplication session. The Quick & Dirty code could also be modified to ignore lock files.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s