FUNCTION REFERENCE

untar

Extract the files of a tar archive.

Extract the files of a tar archive.

Syntax

untar(tarfilename)

Syntax

filenames = untar(tarfilename, outputfolder)

Reads plain or GNU zip compressed ustar archives into outputfolder or the current folder and returns the file names in archive order. Entry names that would leave the output folder are refused.

Example

d=tempname(pwd); mkdir(d); fid=fopen(fullfile(d,'a.txt'),'w'); fprintf(fid,'hi'); fclose(fid); tar(fullfile(d,'a.tar'),'a.txt',d); n=untar(fullfile(d,'a.tar'),fullfile(d,'out')); t=fileread(fullfile(d,'out','a.txt')); rmdir(d,'s'); t   % hi

Differences from MATLAB: Links and other special entries are skipped; URLs are not supported.

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