I would do something like the following: find /root/of/tree [conditions] |tar cjfT backup.tar.bz2 -
That's the cleanest way to do it. Plus, tar will start backing things up as it receives the filenames rather than waiting until find has generated a complete list. I love UNIX. On Wed, Sep 17, 2003 at 04:34:58PM -0600, Jacob Fugal wrote: > I'm writing a script to backup information here at work. However, the > files I want to back up are spread all over a gigantesque directory > tree. Within the same directory tree are many large files, such as > images, that I don't want to include in the backup tarball -- for both > time and space considerations. > > I though to approach this by using find to get the approriate files and > then feed them as command line parameters to tar, via xargs. I've worked > my find statement all out, and am happy with the list of files it gives > me. However, if I just do something like: > > find /root/of/tree [conditions] | xargs tar -cjf backup.tar.bz > > Then only the last 20 or so files end up in the tar ball. That's because > xargs ends up executing tar several times; not once for each file, but > more than once, which isn't what I want. > > I could create the empty archive first, then do tar -cAjf backup.tar.bz > as the xargs parameter to append files to the archive. But this is > slightly less efficient since the archive is being opened and closed > each time xargs appends more files -- which in my case could be a > hundred times or more. > > Is there a way to force xargs to execute the statement it's given only > once, or do I have to go with the alternative above? > > Jacob Fugal > > > ____________________ > BYU Unix Users Group > http://uug.byu.edu/ > ___________________________________________________________________ > List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list >
pgp00000.pgp
Description: PGP signature
____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
