Sample Header Ad - 728x90

7z command to create a XZ file

3 votes
1 answer
3490 views
The man page says 7z tool supports *7z, LZMA2, XZ, ZIP, Zip64, CAB, RAR, ARJ, GZIP, BZIP2, TAR, CPIO, RPM, ISO,* most filesystem images and *DEB* formats. And it says we could pass the type as -t{Type}. The following command is success.
7z a -tzip archive.zip dir1 dir2 file1 file2
But I can't archive the files into .xz using the following command.
7z a -txz archive.zip dir1 dir2 file1 file2
$ 7z a -txz archive.xz dir1 dir2 file1 file2

7-Zip  16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (806E9),ASM,AES-NI)

Scanning the drive:
2 folders, 7 files, 196192711 bytes (188 MiB)

Creating archive: archive.xz

Items to compress: 9



System ERROR:
E_INVALIDARG
Anything I am doing wrong here? How to create .xz file using 7z command? **EDIT:** The following command successful.
7z a -txz archive archive.tar
Does it mean we can use -txz or -tbzip2 on only archive files as we can't directly use compression on files without archiving the files first?
Asked by NayabSD (194 rep)
Sep 22, 2021, 04:46 PM
Last activity: Sep 22, 2021, 05:08 PM