zip
Compress files into ZIP file
Syntax
Description
zip(
compresses the contents of zipfilename
,filenames
)filenames
into the ZIP file
zipfilename
. zip
recursively
compresses the content in folders. The resulting ZIP file contains the paths of
filenames
relative to the current folder. The ZIP file does
not store absolute paths.
zip(
specifies the paths for zipfilename
,filenames
,rootfolder
)filenames
relative to
rootfolder
rather than the current folder.
zip(___,Password=
creates a password-protected, encrypted, ZIP file using the specified password and
encryption method. password
,EncryptionMethod=encryptionmethod
)zip
does not encrypt an empty file. You can
specify these arguments in addition to any of the input argument combinations in the
previous syntaxes. (since R2024b)
returns a cell array of character vectors containing the names of the files included
in entrynames
= zip(___)zipfilename
.
Examples
Input Arguments
Output Arguments
Limitations
On Linux systems, AES-128 and AES-256 encryption methods are not supported.
Alternative Functionality
To ZIP files in the Current Folder browser, select the file, right-click to open the context menu, and then select Create Zip File.