36.3 File Archiving Utilities
- bunzip2 (bzfile)
- bunzip2 (bzfile, dir)
- filelist = bunzip2 (…)
-
Unpack the bzip2 archive bzfile.
If dir is specified the files are unpacked in this directory rather than the one where bzfile is located.
The optional output filelist is a list of the uncompressed files.
- filelist = gzip (files)
- filelist = gzip (files, dir)
-
Compress the list of files and directories specified in files.
files is a character array or cell array of strings. Shell wildcards in the filename such as ‘*’ or ‘?’ are accepted and expanded. Each file is compressed separately and a new file with a ".gz" extension is created. The original files are not modified, but existing compressed files will be silently overwritten. If a directory is specified then
gzip
recursively compresses all files in the directory.If dir is defined the compressed files are placed in this directory, rather than the original directory where the uncompressed file resides. Note that this does not replicate a directory tree in dir which may lead to files overwriting each other if there are multiple files with the same name.
If dir does not exist it is created.
The optional output filelist is a list of the compressed files.
- gunzip (gzfile)
- gunzip (gzfile, dir)
- filelist = gunzip (…)
-
Unpack the gzip archive gzfile.
If gzfile is a directory, all gzfiles in the directory will be recursively unpacked.
If dir is specified the files are unpacked in this directory rather than the one where gzfile is located.
The optional output filelist is a list of the uncompressed files.
- filelist = tar (tarfile, files)
- filelist = tar (tarfile, files, rootdir)
-
Pack the list of files and directories specified in files into the TAR archive tarfile.
files is a character array or cell array of strings. Shell wildcards in the filename such as ‘*’ or ‘?’ are accepted and expanded. Directories are recursively traversed and all files are added to the archive.
If rootdir is defined then any files without absolute pathnames are located relative to rootdir rather than the current directory.
The optional output filelist is a list of the files that were included in the archive.
- untar (tarfile)
- untar (tarfile, dir)
- filelist = untar (…)
-
Unpack the TAR archive tarfile.
If dir is specified the files are unpacked in this directory rather than the one where tarfile is located.
The optional output filelist is a list of the uncompressed files.
- filelist = zip (zipfile, files)
- filelist = zip (zipfile, files, rootdir)
-
Compress the list of files and directories specified in files into the ZIP archive zipfile.
files is a character array or cell array of strings. Shell wildcards in the filename such as ‘*’ or ‘?’ are accepted and expanded. Directories are recursively traversed and all files are compressed and added to the archive.
If rootdir is defined then any files without absolute pathnames are located relative to rootdir rather than the current directory.
The optional output filelist is a list of the files that were included in the archive.
- unzip (zipfile)
- unzip (zipfile, dir)
- filelist = unzip (…)
-
Unpack the ZIP archive zipfile.
If dir is specified the files are unpacked in this directory rather than the one where zipfile is located.
The optional output filelist is a list of the uncompressed files.
- files = unpack (file)
- files = unpack (file, dir)
- files = unpack (file, dir, filetype)
-
Unpack the archive file based on its extension to the directory dir.
If file is a list of strings, then each file is unpacked individually. Shell wildcards in the filename such as ‘*’ or ‘?’ are accepted and expanded.
If dir is not specified or is empty (
[]
), it defaults to the current directory. If a directory is in the file list, then filetype must also be specified.The specific archive filetype is inferred from the extension of the file. The filetype may also be specified directly using a string which corresponds to a known extension.
Valid filetype extensions:
bz
bz2
-
bzip archive
gz
-
gzip archive
tar
-
tar archive
tarbz
tarbz2
tbz
tbz2
-
tar + bzip archive
targz
tgz
-
tar + gzip archive
z
-
compress archive
zip
zip archive
The optional return value is a list of files unpacked.
See also: bunzip2, gunzip, unzip, untar, bzip2, gzip, zip, tar.
- filelist = bzip2 (files)
- filelist = bzip2 (files, dir)
-
Compress the list of files specified in files.
files is a character array or cell array of strings. Shell wildcards in the filename such as ‘*’ or ‘?’ are accepted and expanded. Each file is compressed separately and a new file with a ".bz2" extension is created. The original files are not modified, but existing compressed files will be silently overwritten.
If dir is defined the compressed files are placed in this directory, rather than the original directory where the uncompressed file resides. Note that this does not replicate a directory tree in dir which may lead to files overwriting each other if there are multiple files with the same name.
If dir does not exist it is created.
The optional output filelist is a list of the compressed files.
© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v5.2.0/File-Archiving-Utilities.html