Routines (alphabetical) > Routines: F > FILE_ZIP

# FILE_ZIP

The FILE_ZIP procedure compresses a given set of input files and directories into the PKWARE ZIP file format, using the DEFLATE compression algorithm for all files within the ZIP. The routine uses the ZLIB_COMPRESS function to compress the data within each file.

This routine is written in the IDL language. Its source code can be found in the file `file_zip.pro` in the lib subdirectory of the IDL distribution.

## Examples

This example ZIPs up the resource/fonts subdirectory within the IDL installation, and saves the ZIP file to our current working directory:

dir = FILEPATH('', SUBDIR=['resource','fonts'])

FILE_ZIP, dir, 'idlresources.zip', /VERBOSE

IDL prints:

% C:\Program Files\Exelis\IDL82\resource\fonts\hersh1.chr 54.3%

...

% C:\Program Files\Exelis\IDL82\resource\fonts\tt\ttfont.map 66.2%

% Total 61 files, 970383 bytes, 53.0% space savings

% Time elapsed: 0.22700000 seconds.

## Syntax

FILE_ZIP, Files [, FileOut] [, FILES=variable] [, /LIST] [, /VERBOSE]

## Arguments

### Files

Set this argument to a string or array of strings giving the directories and files to add to the ZIP file. Directories will be recursively searched, and all subdirectories and files within those directories will be added to the zip file.

### FileOut

Set this optional argument to a scalar string giving the output filename. If FileOut is not provided then FILE_ZIP will construct the output filename by taking the first entry in Files and appending the file suffix "`.zip`" to the name.

## Keywords

### FILES

Set this keyword to a named variable. On return, this variable will contain a string array of all of the directories and files added to the ZIP file.

### LIST

Set this keyword to perform all of the FILE_ZIP actions without actually creating a ZIP file. The list of files can be retrieved using the FILES keyword, while the VERBOSE keyword will output the names of the directories and files that would have been added to the ZIP file.

### VERBOSE

Set this keyword to output additional information while the routine is executing.

## Version History

8.2.3 | Introduced

## See Also

FILE_GZIP, FILE_GUNZIP, FILE_TAR, FILE_UNTAR, FILE_UNZIP, ZLIB_COMPRESS, ZLIB_UNCOMPRESS