0

I know how to compress a directory with xz using tar, but is it possible to compress a directory using xz WITHOUT tar?

If I try:

xz -z myDir

Then the following error is retured:

xz: myDir: Is a directory, skipping
Fred
  • 335

1 Answers1

6

xz, like compress, gzip and other Unix-style compressors, is a single-file compressor: it outputs .xz files which are always decompressed to a single file.

Because of that, compressing directories or multiple files requires a container of some sort (if you want to be able to recover the separate files). That’s typically a tar archive, but it could be a cpio archive or some other format.

Stephen Kitt
  • 434,908