Extracting a bzip2 file throws "Can't guess original name" and does not extract separate files

1

I made a bzip2 file by

bzip2 -c /home/os/picture1 > /home/os/Desktop/pic.image

bzip2 -c /home/os/picture2 >> /home/os/Desktop/pic.image

But now extracting pic.image by bzip2 -d /home/os/Desktop/pic.image returns

bzip2: Can't guess original name for pic.image -- using pic.image.out

and then it just creates one file pic.image.out.

How do I access picture1 and picture2 from pic.image?

Usman

Posted 2010-12-13T12:20:21.950

Reputation: 757

Answers

4

bzip2 is compression only. If you want file packing then you need to use tar as well.

Ignacio Vazquez-Abrams

Posted 2010-12-13T12:20:21.950

Reputation: 100 516

And from the documentation: If the file does not end in one of the recognised endings, .bz2, .bz, .tbz2 or .tbz, bzip2 complains that it cannot guess the name of the original file, and uses the original name with .out appended. – Arjan – 2010-12-13T14:02:38.237

so...now...there is no hack to access picture1 or picture2 from pic.image?? :-o – Usman – 2011-01-12T15:53:33.453

1

You should use tar instead :

tar cjf /path/to/pics.tar.bz2 /path/pic1 /path/pic2
tar xjf /path/to/pics.tar.bz2 -C /path/to/extract/

OneOfOne

Posted 2010-12-13T12:20:21.950

Reputation: 889

Okay got you. BUT my file's extension is not .tar.bz2. It's just .image. What do you suggest to get my picture1 and picture2 from pic.image? Got any hack in mind?? – Usman – 2011-01-12T15:54:43.107

hmm, all i can think of is writing a script that reads the file and extracts based on the bzip2 header, however there's no way of restoring the original file names that way. – OneOfOne – 2011-01-12T19:48:08.940