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
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
tarsomewhere that supports this
- someone knows how to use the
tarsuggested to me when I tried
tar -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
xargsor 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.