FUNCTION REFERENCE

tar

Pack files into a tar archive.

Pack files into a tar archive.

Syntax

tar(tarfilename, files)

Syntax

entrynames = tar(tarfilename, files, rootfolder)

Writes ustar headers with GNU long-name records when a UTF-8 entry name does not fit the header. A name ending in .tgz or .tar.gz is also GNU zip compressed, and '.tar' is appended to other names. files works as in zip.

Example

d=tempname(pwd); mkdir(d); fid=fopen(fullfile(d,'a.txt'),'w'); fprintf(fid,'hi'); fclose(fid); names=tar(fullfile(d,'a.tgz'),'a.txt',d); rmdir(d,'s'); names{1}   % a.txt

Differences from MATLAB: At most 10000 files and 256 MiB in total.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.