MATLAB Function Reference |
Compress files into zip-file archive
Syntax
Description
zip(zipfile,files)
creates a zip-file with the name zipfile
from the list of files and directories specified in files
.
zipfile
is a string specifying the name of the zip-file. The .zip
extension is appended to zipfile
if omitted.
files
is a string or cell array of strings containing the list of files or directories included in zipfile
. Paths specified in files
must be either relative to the current directory or absolute. Relative paths are stored in the zip-file, but absolute paths are not. Directories recursively include all their contents.
zip(zipfile,files,rootdir)
allows the path for files
to be specified relative to rootdir
rather than the current directory.
entrynames = zip(...)
returns a string cell array of the relative path entry names contained in zipfile
.
Note
The zip function does not preserve file permissions--file permissions in files are not maintained in zipfile .
|
Zip a File
Create a zip-file of the file guide.viewlet
, which is in the demos
directory of MATLAB. It saves the zip-file in d:/mymfiles/viewlet.zip
.
Zip the files guide.viewlet
and import.viewlet
and save the zip file in viewlets.zip
. The source files and zipped file are in the current directory.
Zip Selected Files
Zip all .m
and .mat
files in the current directory to the file backup.zip
:
Zip a Directory
Zip the directory D:/mymfiles
and its contents to the zip-file mymfiles
in the directory one level up from the current directory.
Zip the files thesis.doc
and defense.ppt
, which are located in d:/PhD
, to the zip-file thesis.zip
in the current directory.
See Also
gzip
, gunzip
, tar
, untar
, unzip
zeros | zoom |
© 1994-2005 The MathWorks, Inc.