I was wondering whether (and, of course, how) it’s possible to tell tar
to extract multiple files in a single run.
I’m an experienced Unix user for several years and of course I know that you can use for
or find
or things like that to call tar
once for each archive you want to extract, but I couldn’t come up with a working command line that caused my tar
to extract two .tar.gz files at once. (And no, there’s nothing wrong with for
, I’m merely asking whether it’s possible to do without.)
I’m asking this question rather out of curiosity, maybe
- there’s a strange fork of
tar
somewhere that supports this - someone knows how to use the
-M
parameter thattar
suggested to me when I triedtar -zxv -f a.tgz -f b.tgz
- we’re all blind and it’s totally easy to do — but I couldn’t find any hint in the web that didn’t utilize
for
orfind
orxargs
or the like.
Please don’t reply with tar -zxvf *.tar.gz
(because that does not work) and only reply with “doesn’t work” if you’re absolutely sure about it (and maybe have a good explanation why, too).
Edit: I was pointed to an answer to this question on Stack Overflow which says in great detail that it’s not possible without breaking current tar
syntax, but I don’t think that’s true. Using tar -zxv -f a.tgz -f b.tgz
or tar -zxv --all-args-are-archives *.tar.gz
would break no existing syntax, imho.
-M
parameter. – Steve-o Sep 01 '11 at 02:49