Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
17
Добавлен:
09.02.2015
Размер:
324.1 Кб
Скачать

Tar file access

<tar> - Compress files into tar file.

TAR Compress files into tar file.

TAR(TARFILENAME,FILES) creates a tar file with the name TARFILENAME

from the list of files and directories specified in FILES. Relative

paths are stored in the tar file, but absolute paths are not.

Directories recursively include all of their content.

TARFILENAME is a string specifying the name of the tar file. The '.tar'

extension is appended to TARFILENAME if omitted. TARFILENAME's

extension may end in '.tgz' or '.gz'. In this case, TARFILENAME is

gzipped.

FILES is a string or cell array of strings that specify the files or

directories to be included in TARFILENAME. Individual files that are

on the MATLABPATH can be specified as partial pathnames. Otherwise an

Individual file can be specified relative to the current directory or

with an absolute path. Directories must be specified relative to the

current directory or with absolute paths. On UNIX systems, directories

may also start with a "~/" or a "~username/", which expands to the

current user's home directory or the specified user's home directory,

respectively. The wildcard character '*' may be used when specifying

files or directories, except when relying on the MATLABPATH to resolve

a filename or partial pathname.

TAR(TARFILENAME,FILES,ROOTDIR) allows the path for FILES to be

specified relative to ROOTDIR rather than the current directory.

ENTRYNAMES = TAR(...) returns a string cell array of the relative path

entry names contained in TARFILENAME.

Example

-------

% Tar all files in the current directory to the file backup.tgz

tar('backup.tgz','.');

See also gzip, gunzip, untar, unzip, zip.

Reference page in Help browser

doc tar

<untar> - Extract contents of tar file.

UNTAR Extract contents of tar file.

UNTAR(TARFILENAME) extracts the archived contents of TARFILENAME into

the current directory and sets the file's attributes. On Windows, the

hidden, system and archive attributes are not set. UNTAR overwrites an

existing file with the same name as the archive name if the existing

file's attributes and ownership permit; otherwise a warning is issued.

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) extracts the archived contents of

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 the temp 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.

Examples

--------

% Copy all *.m files in the current directory to the directory 'backup'

tar('mymfiles.tar.gz','*.m');

untar('mymfiles','backup');

% Untar and 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')

See also fileattrib, gzip, gunzip, tar, unzip, zip.

Reference page in Help browser

doc untar

Соседние файлы в папке Библиотеки Matlab