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 zipshapefile.zip. Because of this steps two and three are obsolete.
- Download the code from here.
Rename the file from zipshapefile-zip.jpg back to zipshapefile.zip.
- Unzip the file.
- Move ZipShapefile.py to C:Program FilesArcGISArcToolBoxScriptsZipShapefile.py.
- Optionally, move Zip Shapefile.tbx, perhaps C:Program FilesArcGISArcToolBoxToolboxes.
- 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 ZipShapefile.py file from the .zip that you downloaded to C:Program FilesArcGISArcToolBoxScripts, the error message is consistent with the tool not being about to find the python script there.
If you prefer to place the ZipShapefile.py 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):