Mike Ciul on 28 Jun 2005 05:13:25 -0000


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

[PLUG] tar and xargs revisited


Hi everyone,

I haven't been to a meeting in ages - it's easy to get out of touch when
you're having kids...

I recently had some trouble with tar and xargs, just like some folks
were talking about in May. I couldn't find anything on the net about it
until today, and here it was, right at home in Philly.

To recap: xargs tar -c doesn't work because tar might be called more
than once, clobbering the archive. The solution was to use tar -r instead.

I had a similar problem when piping tar to gzip - it writes a tremendous
file but doesn't read past the first end-of-archive marker. I
discovered an alternate solution, though I think it only works with GNU
tar:

Don't use xargs at all...

find ... -print0 | tar -c --null -T -

The -T option gets the names of files to archive from a file, STDIN in
this case.

- Mike

-- 
America's car population is increasing at six times the rate of its
human population.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug