Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

gunzip

Extract contents of GNU zip file

Syntax

gunzip(gzipfilenames)
gunzip(gzipfilename,outputfolder)
filenames = gunzip(___)

Description

example

gunzip(gzipfilenames) extracts the archived contents of each file in gzipfilenames to the folder containing gzipfilenames. gunzip does not delete the original GNU zip files.

gunzip recursively extracts the content in folders. gunzip can extract files from your local system or files from an Internet URL.

example

gunzip(gzipfilename,outputfolder) extracts gzipfilename into outputfolder. If outputfolder does not exist, MATLAB® creates it.

example

filenames = gunzip(___) returns a cell array of character vectors containing the relative path names of all resulting files. You can use this syntax with any of the input argument combinations in the previous syntaxes.

Examples

collapse all

Use the gunzip function to extract all the GNU zip files in the current folder.

files = gunzip('*.gz')
files = 1x1 cell array
    {'membrane.m'}

Download and extract an archive file from a URL to a local folder.

Suppose you have the archive file example.tar.gz stored at the URL http://example.com/example.tar.gz. Download and extract the file to the example folder.

url = 'http://example.com/example.tar.gz';
gunzip(url, 'example');
untar('example/example.tar','example');

Input Arguments

collapse all

Names of the GNU zip files to extract from, specified as a character vector or a cell array of character vectors. File names must include a path relative to the current folder or an absolute path.

If gzipfilename is a URL, gzipfilename must include the protocol type (for example, http://). MATLAB downloads the URL to the temporary folder on your system, and then it deletes the URL on cleanup.

Target folder for the extracted files, specified as a character vector.

See Also

| | |

Introduced before R2006a

Was this topic helpful?