ArcGIS Server Banner

Python scripts to zip and unzip data

Python scripts to zip and unzip data

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
The topic Input and output data types discusses the use of File data types for input and output parameters in tools published to ArcGIS Server. A technique you can use for folder-based workspaces (file geodatabase, coverages, and shapefiles) is to use the Zip compression utility to make a .zip file out of a workspace, then use the result .zip file as input to the model. Within the model, you can use the unzip script (see below) to unzip the file into a workspace, and proceed from there. The same is true for outputs—you can create a .zip file of a workspace and use that for output.

For an example of using the zip script, see GP Service example: Clip and ship and GP Service example: Data on demand.

The Model and Script Tool Gallery in the Geoprocessing Resource Center has a toolbox you can download that contains utilities to zip and unzip files and folders.

Go to the download page for the zip and unzip utilities

If you do not have web access, you can create your own script tools to zip and unzip using the code describe below.