Archives

edit

The tool converts an archive to another archive format. It copies the files and the folders with their names, their modification times and their Unix permissions, in the order of the input archive.

FormatExtensionsReadWrite
Zip.zipYesYes
7z.7zYesYes
RAR.rarYesNo
Tar.tarYesYes
TarGz.tar.gz, .tgzYesYes
TarBz2.tar.bz2, .tbz2, .tbzYesYes
TarXz.tar.xz, .txzYesYes
TarLzma.tar.lzma, .tlzmaYesYes
TarLz.tar.lz, .tlzYesYes
TarZst.tar.zst, .tzstYesNo
TarZ.tar.Z, .tazYesNo

The format of an input is detected from its content. Each input archive gives one output archive, next to it by default:

Meziantou.Framework.FileConversion.Tool backup.rar --output-format zip
Meziantou.Framework.FileConversion.Tool "downloads/*.zip" --output "converted/{name}.tar.xz"
Meziantou.Framework.FileConversion.Tool sources.tar.gz --output-format 7z --archive-compression-level SmallestSize

The first command writes backup.zip. The name of the output drops the whole extension of the input, so sources.tar.gz gives sources.7z.

An EPUB book or a comic book archive converts to an archive format the same way: every file it contains is copied.

The tar and zip formats store symbolic links, and tar stores hard links: they are copied as links. The 7z output does not store them: the tool skips the symbolic links, writes the content of the file a hard link points to, and reports each skipped link on the error output.

Compression

OptionApplies toDescription
--archive-compression-levelzip, 7z, compressed tarOptimal (the default), Fastest, SmallestSize or NoCompression
--zip-compression-methodzipDeflate (the default), Stored, BZip2, Lzma, Ppmd, Xz or Zstandard. Zstandard needs .NET 11
--7z-compression-method7zLzma2 (the default), Lzma, BZip2, Deflate, Ppmd or Copy
--7z-solid7zCompress the files together, which makes the archive smaller. true by default

Passwords

--archive-password reads the zip, 7z and RAR inputs that are encrypted. A wrong or missing password is an error.

The zip and 7z outputs can be encrypted:

Meziantou.Framework.FileConversion.Tool private.rar --archive-password "input password" --output-format 7z --7z-password "output password" --7z-encrypt-headers
Meziantou.Framework.FileConversion.Tool data.tar.gz --output-format zip --zip-password "output password"
OptionDescription
--zip-passwordEncrypt the files of a zip output with this password
--zip-encryptionAes256 (the default), Aes192, Aes128 or ZipCrypto. ZipCrypto is weak, but older tools only read this one
--7z-passwordEncrypt the content of a 7z output with this password (AES-256)
--7z-encrypt-headersAlso encrypt the names of the files of a 7z output, so that the archive cannot be listed without the password

A password on the command line can be read by the other users of the computer, and is saved in the history of the shell.