MATLAB Function Reference Previous page   Next Page
tar

Compress files into tar-file

Syntax

Description

tar(tarfilename,files) creates a tar-file with the name tarfilename from the list of files and directories specified in files.

tarfilename is a string specifying the name of the tar-file. The .tar extension is appended to tarfilename if omitted. The tarfilename extension can end in .tgz or .gz. In this case, tarfilename is gzipped.

files is a string or cell array of strings containing the list of files or directories included in tarfilename. Paths specified in files must be either relative to the current directory or absolute. Relative paths are stored in the tar-file, but absolute paths are not. Directories recursively include all their contents.

tar(tarfilename,files,rootdir) allows the path for files to be specified relative to rootdir rather than the current directory.

entrynames = tar(...) returns a string cell array of the relative path entry names contained in tarfilename.

Example

Tar all files in the current directory to the file backup.tgz:

See Also

gzip, gunzip, untar, unzip, zip


Previous page  tanh  tempdir Next page

© 1994-2005 The MathWorks, Inc.