Example command:
$ tar -cvjf destination.tar.bz2 /path/to/folder/source

I'd like the final destination.tar.bz2, when extracted, to not include a /path/to/folder/ file directory. It seems inefficient to extract the tarball and then mv the contents of /path/to/folder/source to a different directory.

link|improve this question

feedback

2 Answers

up vote 6 down vote accepted

tar -C /path/to/folder -cvjf /path/for/acrhive.tar.bz2 source

-C (uppercase) means 'change directory', so your file specification becomes relative to the path provided with -C

link|improve this answer
feedback

There are many ways to accomplish that, but this is probably the simplest:

cd /path/to/folder
tar -cvjf /past/to/destination.tar.bz2 source
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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