| MATLAB Function Reference | ![]() |
untar(tarfilename)
untar(tarfilename,outputdir)
untar(url, ...)
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, files from rerunning untar on the same tar filename do not overwrite any of those files that have a read-only attribute; instead, untar issues 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 until a file exists. 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. outputdir is created if it does not exist.
untar(url, ...) extracts the tar archive from an Internet URL. The URL must include the protocol type (e.g., 'http://' or 'ftp://'). The URL is downloaded to a temporary directory and deleted.
filenames = untar(...) extracts the tar archive and returns the relative path names of the extracted files into the string cell array filenames.
Copy all .m files in the current directory to the directory backup:
tar('mymfiles.tar.gz','*.m');
untar('mymfiles','backup');
Run untar to list Cleve Moler's "Numerical Computing with MATLAB" examples to the output directory ncm:
url ='http://www.mathworks.com/moler/ncm.tar.gz'; ncmFiles = untar(url,'ncm')
![]() | unregisterevent | unwrap | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |