Compress files into GNU zip files


filenames = gzip(...)


gzip(files) creates GNU zip files from the list of files specified in files. Directories recursively gzip all their contents. Each output gzipped file is written to the same directory as the input file and with the file extension .gz.

files is a string or cell array of strings containing a list of files or directories to gzip. Individual files that are on the MATLAB® path can be specified as partial path names. Otherwise, an individual file can be specified relative to the current directory or with an absolute path.

Folders must be specified relative to the current folder or with absolute paths. On UNIX® systems, folders can also start with ~/ or ~username/, which expands to the current user's home folder or the specified user's home folder, respectively. The wildcard character * can be used when specifying files or folders, except when relying on the MATLAB path to resolve a file name or partial path name.

gzip(files,outputdir) writes the gzipped files into the directory outputdir. If outputdir does not exist, MATLAB creates it.

filenames = gzip(...) gzips the files and returns the relative path names of all gzipped files in the string cell array filenames.


To gzip all .m and .mat files in the current directory and store the results in the directory archive, type:


See Also

| | | |

Was this topic helpful?