[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A silly question about tar



On 2007-03-17, Douglas Allan Tutty <dtutty@porchlight.ca> wrote:
>
> You use find to spit out a list of the files you want (you _may_ be able
> to just use ls -1 .tar), pipe that through xargs.  Something like this:
>
> 	ls -1 .tar.gz | xargs tar [tar options -f ]
>
> for each line of input it receives, xargs will tack it to the end of the
> command line you give it (in the example, it will be tacked on after the
> -f).
>
> I have not tested this, YMMV.

I have, and unfortunately it doesn't work. The result is the same as
the original problem with the regular * expansion:

tyler:tar-> find ./ -name '*.tar.gz' | xargs echo
../one.tar.gz ./three.tar.gz ./two.tar.gz

replace echo with tar, and you see that tar is going to try and
extract the second and third archives from within the first archive,
which fails. I think you have to use some sort of loop, as other
posters have suggested.

-- 
Regards,

Tyler Smit



Reply to: