LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar multiple directories into one file (https://www.linuxquestions.org/questions/linux-newbie-8/tar-multiple-directories-into-one-file-880881/)

davedpss 05-15-2011 03:49 PM

tar multiple directories into one file
 
I have found ways to tar a directory and exclude certain directories but is there a way to simply tar multiple directories (they are in the same directory) in to one .tgz file? thx.

John VV 05-15-2011 04:35 PM

see:
Code:

man tar

markush 05-15-2011 04:38 PM

Hello davedpss,

Code:

tar cf directories.tar dir1 dir2 dir3
will tar the directories dir1, dir2 and dir3 into an archive named directories.tar.

Markus

smoker 05-15-2011 04:44 PM

It depends on what you want to do.

tar -cvf tarfile.tar dir1 dir2 dir3

tar -cvf tarfile.tar *

tar -cvf tarfile.tar -T filename_where_files_are_listed

man tar

davedpss 05-15-2011 07:02 PM

I don't know how I missed this. I thought I had tried that and didn't get the result I was expecting. Obviously I was wrong. I should have suspected something when I didn't see a post on this when I searched this forum. Maybe the next person to search on this will appreciate that I asked the obvious question and get his question answered.

For the guy who simply answered "man tar" why bother? You feel better?

Thanks to those that answered the question.

MTK358 05-15-2011 08:08 PM

Quote:

Originally Posted by davedpss (Post 4357333)
For the guy who simply answered "man tar" why bother? You feel better?

What's wrong with that answer? There are many newbies who don't know about man.

Anyway, since the issue is solved, you should mark the thread as solved now.

NirvanaII 05-15-2011 09:43 PM

Quote:

Originally Posted by MTK358 (Post 4357359)
What's wrong with that answer? There are many newbies who don't know about man.

That might well be true, but I suspect 9 times out of 10 the person to proffer the advice 'man whatever' does not do so to be helpful. I get annoyed on the OPs behalf when I read responses like that, especially where it costs nothing just to be helpful and give a solution.

corp769 05-15-2011 09:48 PM

Quote:

Originally Posted by NirvanaII (Post 4357419)
That might well be true, but I suspect 9 times out of 10 the person to proffer the advice 'man whatever' does not do so to be helpful. I get annoyed on the OPs behalf when I read responses like that, especially where it costs nothing just to be helpful and give a solution.

I notice that those 9 out of 10 times is when the man page either isn't good enough, doesn't include good enough "examples," or the person reading it does not fully understand what he/she is reading. Me personally, man pages are always useful.

davedpss 05-16-2011 02:21 PM

Just for the record, I did use the man page and I searched on the internet and I searched this forum. Man pages to me are at times helpful and at times confusing. I didn't find this answer there - it was neither obvious nor obscure. I have no problem with someone telling me about the man page in the spirit of being helpful. The answer to this question could have easily been answered in the same amount of time and effort (and was) and then add that man tar would provide more info if they thought I was unaware of man.

I've used enough lists to know that there is a certain percentage of users that are arrogant and rude. Every time I post a question, I'm planning that somebody is going to take a shot at it to prove their superiority. I'm new to a lot of this stuff (that's why the newbie forum) and I'm sure I will ask more questions that seem stupid to some. I am grateful to those that did answer the question. I want to rip off a bunch of nasty comments and obscenities here but hey, what good would that do.

Now I'm going to set myself up here for someone to take another shot but I would like to show this as solved but not sure how to do that (yes, i have looked around and no, i haven't found anything)

Thanks.


All times are GMT -5. The time now is 05:52 AM.