Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm having an issue using Barcat to show a dialog while compressing? Wondering what the exact syntax is?

here's a link to Barcat

things I've tried are

  bar -n apache24.tar.xz |tar -Jcf -
  bar -n apache24.tar.xz |tar -Jcf - apache24/
  bar -n apache24.tar.xz |tar -Jcf apache24/ - 
  bar -c 'tar -Jcf apache24/ apache.tar.xz'
  bar -c 'tar -Jcf apache.tar.xz apache24/'
  bar -n apache24.tar.xz apache24/ |tar -Jcf - 
  bar -n apache24/ apache24.tar.xz |tar -Jcf - 
  bar -n apache24/ |tar -Jcf - 
  bar -n apache24/ |tar -Jcf -- apache.tar.xz
  bar -n apache.tar.xz  |tar -Jcf apache24/ --
  bar -n apache.tar.xz -- apache24/ |tar -Jcf -
  bar -n apache.tar.xz apache24/ |tar -Jcf -
  bar -n apache.tar.xz apache24/ |tar -Jcf --
  bar -n apache24/ apache.tar.xz |tar -Jcf -

Excuse any dupes I just pasted from history

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It can't do that, at least not as conveniently as you'd probably like. To understand why, you have to consider how such a program would work. In the decompression case, it can easily stat the original .tar.xz file to get its size, and the progress can be computed as the number of bytes that have passed through bar, divided by the file size. But in the compression case, bar isn't smart enough to figure out the original size of the directory, nor does it know the ultimate size of an input that's piped to it (e.g., if the output of tar is streamed to bar).

bar seems to accept a -s option so that you can help it out with the expected size, but I couldn't get it to actually produce a correct output. That looks something like this, if you want to play around with it more:

tar cf - apache24/ | bar -s $(du -sb apache24 | cut -f1) | xz > apache24.tar.xz

In practice, you'd probably have to add a fudge factor to the du output to account for the overheads in the tar format. Obviously, not very convenient to have to do.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.