tar noob question

Charles Curley charlescurley at charlescurley.com
Wed Mar 23 14:31:12 MST 2005


On Wed, Mar 23, 2005 at 01:25:28PM -0700, Kenneth Burgener wrote:
> Kenneth Burgener wrote:
> >You could use the find command:
> >
> >find . -iname "*.csv" -exec tar -af archive.tar {} \;
> 
> Sorry, small correction.  The append option is -r not -a:
> 
> find . -iname "*.csv" -exec tar -af archive.tar {} \;

Nice. However, if you run this more than once without
deleting/moving/etc. the archive, you'll append to the existing
archive each time you run it, probably not what you want.

Try instead:

find -iname "*.csv" | xargs tar -cvjf archive.tar.bz2

That will create the archive anew each time, and should also be
faster.

Er, if you don't want bzip2 compression on the fly, take out the j
option to tar.

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20050323/ff67797f/attachment.bin 


More information about the PLUG mailing list