creates a compressed archive in the current directory from a file or directory specified by source.
creates a compressed archive in the directory or file specified by path.
Details and Options
- CreateArchive infers the compression format from the file extension of the archive name. If no extension is given, CreateArchive uses ZIP compression.
- Possible file extensions include ".zip", ".gz", ".tar.gz", ".bz2", ".tar.bz2", ".tbz", ".tbz2", ".tb2", and ".tgz".
- CreateArchive[source] creates an archive file in the current working directory.
- The source as well as the destination path can be a relative or absolute directory or file specification.
- Relative directory or file paths are taken to be relative to the current working directory.
- If a destination directory is given, CreateArchive automatically chooses a suitable file name for the archive.
- CreateArchive returns the full file name of the archive it created, and $Failed if it cannot be created.
- The file archive to be created must not already exist.
- CreateArchive takes an option CreateIntermediateDirectories to specify whether intermediate directories should be created. The default setting is True.
- CreateArchive does not delete the source file or directory.
- CreateArchive[File["source"]] and CreateArchive["Source",File["path"]] are also supported.
Examplesopen allclose all
Basic Examples (4)
Introduced in 2010