This is machine translation

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


Extract contents of tar file


filenames = untar(___)


untar(tarfilename) extracts the archived contents of tarfilename into the current directory and sets the files' attributes. It overwrites any existing files with the same names as those in the archive if the existing files' attributes and ownerships permit it. For example, if you rerun untar on the same tarfilename, MATLAB® software does not overwrite files with a read-only attribute; instead, untar displays a warning for such files. On Microsoft® Windows® platforms, the hidden, system, and archive attributes are not set.

tarfilename is a string specifying the name of the tar file. tarfilename is gunzipped to a temporary directory and deleted if its extension ends in .tgz or .gz. If an extension is omitted, untar searches for tarfilename appended with .tgz, .tar.gz, or .tar. tarfilename can include the directory name; otherwise, the file must be in the current directory or in a directory on the MATLAB path.

untar(tarfilename,outputdir) uncompresses the archive tarfilename into the directory outputdir. If outputdir does not exist, MATLAB creates it.

untar(url,___) extracts the tar archive from an Internet URL. The URL must include the protocol type (for example, 'http://' or 'ftp://'). MATLAB downloads the URL to a temporary directory, and then deletes it.

filenames = untar(___) extracts the tar archive and returns the names of the extracted files in the string cell array filenames. If outputdir specifies a relative path, filenames contains the relative path. If outputdir specifies an absolute path, filenames contains the absolute path.


Using tar and untar to Copy Files

Copy all .m files in the current directory to the directory backup.


Using untar with URL

Run untar to list Cleve Moler's "Numerical Computing with MATLAB" examples to the output directory ncm.

url ='';
ncmFiles = untar(url,'ncm')

See Also

| | | |

Introduced before R2006a

Was this topic helpful?