5

I've tried several invocations of the OEM tar to create LZMA-compressed tarballs. More specifically, I tried:

tar -c -f --lzma Windows\ 7.vmwarevm.tar.lzma Windows\ 7.vmwarevm

My efforts created an archive with filename --lzma, and tar complained of Windows 7.vmwarevm.tar.lzma: Cannot stat: No such file or directory, probably for the same reason: --lzma was taken as the filename of the archive to be created, and consequently the actual intended archive name was taken to be the first in a list of arguments to include in the archive.

I thought after some searching that MacOS had not included it in the provided options, and built GNU tar from scratch, storing it under another name in /usr/local/bin. However, my efforts to use the above invocation with the renamed and newly built tar had the same effect: I was building an archive in --lzma.

My computer has a seemingly working /usr/local/bin/lzma.

What invocation(s) should I use, perhaps piping tar to lzma and perhaps in a script to do the work of "tar czf foo.tgz foo", but uses lzma instead of gzip for compression?

Christos Hayward
  • 529
  • 1
  • 6
  • 17

2 Answers2

6

When using tar, the first word after -f is the output filename. In your case, switching the order of options might be enough:

tar -c --lzma -f foo.tar.lzma sourcefile(s)
0

I agree with drewbenn,

it might also work in case to

tar c files folders/ | lzma --options-here > foo.tar.lzma

This might also work for in case if you want to use any parallel compressors to speed up the thing.

djdomi
  • 121
  • 8