Skip to content

__unpack__

miscellaneous · scripts/miscellaneous/__unpack__.m

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

Extract the contents of the archive file into the folder dir, which is created when it does not exist. The default folder is the current one.

file is a string, a wildcard pattern, or a cell array of those; every archive found is extracted, and the archive itself is kept. The kind of archive follows from the extension unless filetype is given, as one of "zip", "tar", "tar.gz", "tgz", "tar.bz2", "tbz2", "tar.xz", "gz", "bz2" or "xz". Files with another extension are left alone.

The result is a row cell array with the path of every extracted item (folders included), each starting with dir.