simplearchiver - An alternative to tar
simplearchiver [-h | --help] [ options ] (-c | -t | -x) (-f filename) [--] paths...
simplearchiver archives files/directories into an archive file with support for any compressor that accepts file data in standard-input and outputs compressed file data to standard-output.
Unlike tar, when simplearchiver uses a compressor (e.g. with --compressor compressor-command), the data is compressed inside of simplearchiver's file format, while tar expects the tar file itself to be compressed.
Prints the "help text" which lists all options with a brief usage hint.
Tells simplearchiver to be in "create archive file" mode. This mode causes simplearchiver to create the archive (specified with -f file) given the positional arguments as paths to archive. Note that a positional argument of "." will cause simplearchiver to archive everything in the current directory (or the directory specified with -C path).
Tells simplearchiver to be in "test archive file" mode. Any archive file specified with -f file will be inspected and its contents and relative metadata will be printed to standard-error.
Tells simplearchiver to be in "extract archive file" mode. Any archive file specified with -f file will be extracted to the current working directory (or to the directory specified with -C path).
Sets the filename to be created in "create archive file" mode, checked with "test archive file" mode, or extracted from with "extract archive file" mode. Note that in "create archive file" mode, the file will not be overwritten if it already exists unless if --overwrite-create is specified. Note that this is not affected by -C directory. If "-" is specified as the filename, then standard-output will be used as the file when in "create mode", and standard-input will be used as the file when in "test mode" or "extract mode".
Sets the current working directory for archiving or extracting. Note that this does not affect -f filename.
Sets a prefix-string to be prepended to every extracted file/directory. Note that if the prefix-string does not end with a "/", then "/" will be appended to it before it is used. This affects archive creation and extraction.
Enables compression and sets the compressor when creating an archive with the given compressor command. For example, --compressor "gzip", or --compressor="xz" can be used. Using this option requires the use of --decompressor decompressor_command.
Sets the decompressor to be used when an archive is to be extracted later. This is done by storing the command verbatim in the archive's data when creating an archive. For example, --decompressor "gzip -d", or --decompressor="unxz" can be used. This option can also be used when extracting to override the decompressor command stored in the archive.
Tells simplearchiver to overwrite the archive file (specified with -f filename) when creating an archive.
Tells simplearchiver to overwrite files when extracting from an archive file.
Disables storing of absolute paths for symlinks when they are archived.
Preserves symlinks by not changing their paths when they are archived. By default, symlink paths are regenerated to produce valid relative and absolute paths that are both stored upon archive creation.
On archive creation, enables storing links that point to any path that does not exist in the created archive. On archive extraction, enables creating links that point to any path that does refer to any extracted file.
Sets the directory to store temporary files. Note that temporary files are only created when creating and archive and when compression is being used such that the temporary file is a compressed file/chunk and is stored into the archive after the file/chunk has been fully compressed. Naturally, these temporary files should be automatically deleted by simplearchiver after they are used. By default, the directory used is the directory holding the output archive. If the output is standard-output, then tmpfile(3) is used instead.
Forces temporary files to use tmpfile(3) when they are created. Note that this option is mutually exclusive with --temp-files-dir.
Forces simplearchiver to use the specified file format version. Currently there are versions 0 through 5, and the default is the latest file format. If you are not sure which to use, it is best to just use the latest version, which is the default.
Sets the minimum chunk size when creating archives. By default, this is 256MiB. Note that this value must be specified in bytes or with one of the following suffixes (without spaces): KB, KiB, MB, MiB, GB, or GiB. "32MiB" is valid but "32 MiB" is not. The behavior is as follows: combine files into a chunk until the size of the chunk is at least the "chunk-min-size" value. When it reaches the value, then the chunk is created/compressed and a new chunk is designated for the remaining files until there are none left. If there are no more files to put in a chunk before this limit is reached, then the chunk will simply stop accumulating files and will be stored/compressed as the last chunk.
Do not pre-sort files before they are stored into a new archive. By default, files are sorted by size such that the largest file is archived first. If this option is specified, then the files will be stored in an arbitrary order. This option is mutually exclusive with "--sort-files-by-name". Note that this option may not apply to file format 0.
Sorts files by filename before archiving. This option is mutually exclusive with "--no-pre-sort-files". Note that this option may not apply to file format 0.
Do not store empty directories in the archive when created. Note that storing of empty directories is only done for file formats 2 and onwards by default.
Force the ownership of all archived items to the given UID when creating an archive. Note that this option will only take effect on extraction if the current effective user ID is 0 (root).
Force the ownership of all archived items to the given user when creating an archive. If the user does not exist on the machine creating/extracting an archive, then simplearchiver will stop with an error. Note that this option will only take effect on extraction if the current effective user ID is 0 (root).
Force the group of all archived items to the given GID when creating or extracting an archive. Note that this option will only take effect on extraction if the current effective user ID is 0 (root).
Force the group of all archived items to the given group when creating an archive. If the group does not exist on the machine creating/extracting an archive, then simplearchiver will stop with an error. Note that this option will only take effect on extraction if the current effective user ID is 0 (root).
Prefer the archive's stored UID over username. By default, the username stored in the archive is preferred.
Prefer the archive's stored GID over groupname. By default, the groupname stored in the archive is preferred.
Store a mapping from a UID/Username to another UID/Username. This will be used to convert UIDs when archiving. Note that this option will only take effect on extraction if the current effective user ID is 0 (root).
Store a mapping from a GID/Grouname to another GID/Groupname. This will be used to convert GIDs when archiving. Note that this option will only take effect on extraction if the current effective user ID is 0 (root).
Force set permissions for files on archive creation. Note that this option will only take effect on extraction if the current effective user ID is 0 (root). For example, a valid value can be 644 or 440.
Force set permissions for directories on archive creation. Note that this option will only take effect on extraction if the current effective user ID is 0 (root). For example, a valid value can be 755 or 750. Note that this does not have any effect on empty directories. See the following option to force permissions on empty directories.
Force set permissions for empty directories on archive creation. Note that this option will only take effect on extraction if the current effective user ID is 0 (root). For example, a valid value can be 755 or 750. Note that this does not effect intermediate directories that hold files/directories. See the previous option to force permissions on such directories.
Force set permissions for directories created with --prefix on archive extraction. For example, a valid value can be 755 or 750. Note that this option only has effect on prefix directories, not files/dirs within them.
Sets the UID of prefix dir(s) (only if root or has CAP_CHOWN). Mutually exclusive with --set-prefix-dir-user.
Sets the UID of prefix dir(s) (only if root or has CAP_CHOWN) that should have the same UID has the specified user. Mutually exclusive with --set-prefix-dir-uid.
Sets the GID of prefix dir(s) (only if root or has CAP_CHOWN). Mutually exclusive with --set-prefix-dir-group.
Sets the GID of prefix dir(s) (only if root or has CAP_CHOWN) that should have the same GID has the specified group. Mutually exclusive with --set-prefix-dir-gid.
In any archival mode (create/test/extract), only allow files/directories that contain the specified text. Use this flag multiple times to add more text entries such that any file/directory path that has ANY of the specified texts will be allowed/whitelisted.
In any archival mode (create/test/extract), only allow files/directories that contain the specified text. Use this flag multiple times to add more text entries such that any file/directory path that has ALL of the specified texts will be allowed/whitelisted.
In any archival mode (create/test/extract), only allow file/directory paths that start with the specified text. Use this flag multiple times to add more text entries such that any path that STARTS with ANY of the specified texts will be allowed/whitelisted.
In any archival mode (create/test/extract), only allow file/directory paths that end with the specified text. Use this flag multiple times to add more text entries such that any path that ENDS with ANY of the specified texts will be allowed/whitelisted.
In any archival mode (create/test/extract), only block files/directories that contain the specified text. Use this flag multiple times to add more text entries such that any file/directory path that has ANY of the specified texts will be blocked/blacklisted.
In any archival mode (create/test/extract), only block files/directories that contain the specified text. Use this flag multiple times to add more text entries such that any file/directory path that has ALL of the specified texts will be blocked/blacklisted.
In any archival mode (create/test/extract), only block file/directory paths that start with the specified text. Use this flag multiple times to add more text entries such that any path that STARTS with ANY of the specified texts will be blocked/blacklisted.
In any archival mode (create/test/extract), only block file/directory paths that end with the specified text. Use this flag multiple times to add more text entries such that any path that ENDS with ANY of the specified texts will be blocked/blacklisted.
Makes any whitelist/blacklist option case-insensitive (applies only to ASCII characters).
Prints to stderr the preset used by --use-file-exts-preset.
Enables a preset of known file extensions to be checked against when archiving with compression for file format version 6 (and onward). In other words, each file extension in the preset is added to a set that will be checked against when checking each file in a chunk. Note that file extension checking is case insensitive.
Adds an extension to the set of known file extensions to be checked against when archiving with compression for file format version 6 (and onward). Note that file extension checking is case insensitive.
Allows positional arguments to contain ".." in them.
When using file format version 6 and extracting an archive, this options tells simplearchiver to remove unnecessary empty directories. Note that file version format 6 adds support for storing all directories in the given paths when archiving with metadata for each one (such as permissions). This is handy for cases where white/blacklists are used and it is desired to remove directories that are empty as a result of using white/blacklists during extraction.
When using --v6-remove-empty-dirs with this option, all empty dirs are removed regardless of whether or not they were empty leaf dirs during archival. Thus, if there exists a tree of directories with no files after file extraction, then they will be removed.
Prints the current version of simplearchiver.
Specifies that the following arguments are positional arguments that refer to items to be archived or items to be tested/extracted.
Whenever simplearchiver creates an archive with a compressor, a temporary file is created to hold the compressed file/chunk. This is necessary because simplearchiver is designed to be streamable, and the size of the compressed file/chunk is required before storing the compressed data; Otherwise, simplearchiver cannot store the length of the data before the data itself in the archive without seeking. Note that by default, the temporary file is stored in the same directory as the created archive file. If the output is standard-output or cannot be accessed, then tmpfile(3) is used. Options that are related to this behavior are:
--temp-files-dir
--force-tmpfile
Starting in file format version 1 (and up to the latest format), simplearchiver stores files in "chunks". The size of each chunk is controlled by the --chunk-min-size option and is by default 256MiB. It may be better to use a larger chunk size if using a compressor with a higher compression level. Suffixes are supported (without spaces): "KB, KiB, MB, MiB, GB, and GiB". For example, "32MiB" is valid but "32 MiB" is not. The behavior of chunks is as follows: combine files into a chunk until the size of the chunk is at least the "chunk-min-size" value. When it reaches the value, then the chunk is created/compressed and a new chunk is designated for the remaining files until there are none left. If there are no more files to put in a chunk before this limit is reached, then the chunk will simply stop accumulating files and will be stored/compressed as the last chunk.
By default, simplearchiver archives both relative and absolute paths for every symlink upon archive creation, and on extraction relative links are preferred. If the symlink points to a path not archived and --no-safe-links is specified, then the absolute path is preferred on extraction. Also note that absolute paths can be prevented from being stored on archive creation with --no-abs-symlink. Note that specifying both --no-safe-links and --preserve-symlinks will store all symbolic links as is when creating an archive.
By default, simplearchiver will always compress every chunk if a compressor (and decompressor) is specified. Two options --use-file-exts-preset and --add-file-ext add file extensions to a set that is intially empty when the program starts. Using these flags opts-in to not compressing every file that has a matching file extension. This is done by placing every file that matches a "non-compressible-extension" into the first chunk that is set to not be compressed, even if a compressor is specified. Note that this does not affect files that do not match the set of file extensions of files to not compress. If these options are not used or if no file matches any of the set file extensions, then the default behavior is used, which is to compress every chunk if a compressor is specified.
If libcap support is compiled/available, then the CAP_CHOWN capability can be checked for in addition to the check if the user is root to change file/directory permissions. Note that file/directory ownership are always stored when archiving, but when extracting ownership is not set on extracted files/dirs unless if the user is root or has CAP_CHOWN.
The check for whether or not chown can be used works as follows:
Check if current user is root. If is root, then can chown.
Check if current user has CAP_CHOWN if has libcap support. If user has this capability, then can chown.
Previous checks failed, cannot use chown.
One may check the flags in the CMakeLists.txt file to enable libcap support.