### 36.3 File Archiving Utilities

Function File: bunzip2 (bzfile)
Function File: bunzip2 (bzfile, dir)

  Unpack the bzip2 archive bzfile to the directory dir. If dir is not specified, it defaults to the current directory.

  See also: bzip2, unpack, gunzip, unzip, untar.

Function File: entries = gzip (files)
Function File: entries = gzip (files, outdir)

  Compress the list of files and/or directories specified in files. Each file is compressed separately and a new file with a `".gz"` extension is created. The original files are not modified. Existing compressed files are silently overwritten. If outdir is defined the compressed files are placed in this directory.

  See also: gunzip, bzip2, zip, tar.

Function File: gunzip (gzfile, dir)

  Unpack the gzip archive gzfile to the directory dir. If dir is not specified, it defaults to the current directory. If gzfile is a directory, all gzfiles in the directory will be recursively gunzipped.

  See also: gzip, unpack, bunzip2, unzip, untar.

Function File: entries = tar (tarfile, files)
Function File: entries = tar (tarfile, files, root)

  Pack files files into the TAR archive tarfile. The list of files must be a string or a cell array of strings.

  The optional argument root changes the relative path of files from the current directory.

  If an output argument is requested the entries in the archive are returned in a cell array.

  See also: untar, bzip2, gzip, zip.

Function File: untar (tarfile)
Function File: untar (tarfile, dir)

  Unpack the TAR archive tarfile to the directory dir. If dir is not specified, it defaults to the current directory.

  See also: tar, unpack, bunzip2, gunzip, unzip.

Function File: entries = zip (zipfile, files)
Function File: entries = zip (zipfile, files, rootdir)

  Compress the list of files and/or directories specified in files into the archive zipfile in the same directory. If rootdir is defined the files are located relative to rootdir rather than the current directory.

  See also: unzip, bzip2, gzip, tar.

Function File: unzip (zipfile)
Function File: unzip (zipfile, dir)

  Unpack the ZIP archive zipfile to the directory dir. If dir is not specified, it defaults to the current directory.

  See also: zip, unpack, bunzip2, gunzip, untar.

Function File: files = unpack (file)
Function File: files = unpack (file, dir)
Function File: files = unpack (file, dir, filetype)

  Unpack the archive file based on its extension to the directory dir. If file is a list of strings, then each file is unpacked individually. If dir is not specified, it defaults to the current directory. If a directory is in the file list, then the filetype must also be specified.

  The optional return value is a list of files unpacked.

  See also: bzip2, gzip, zip, tar.

Function File: entries = bzip2 (files)
Function File: entries = bzip2 (files, outdir)

  Compress the list of files specified in files. Each file is compressed separately and a new file with a `".bz2"` extension is created. The original files are not modified. Existing compressed files are silently overwritten. If outdir is defined the compressed files are placed in this directory.

  See also: bunzip2, gzip, zip, tar.