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

Re: quick tar question



On Sat, 30 Mar 2002, Robert Schwartz wrote:

> I'm trying to tar up the contents of an OpenBSD system and I wanted to
> know if there's a way to make tar skip a directory or a file
>
> For instance:
>
> > tar czfv /tmp/backup.tgz /
>
> I want to skip that /tmp directory so it doesn't spit out an error when
> it's finished.
>
> Any ideas?
>
> TIA
> Robert
>
gnu tar lets you use a list of files or directories to include

	tar -czvf mytar.tar.gz --files-from=mylist

where mylist is a simple list of files and directories, one per line,
or a list of files or directories to exclude, based on a globbing
pattern.  The globbing pattern can either be specified in the command line
or placed in a file.  In the latter case, the command is

	tar -czvf mytar.tar.gz --exclude-from=mylist

where mylist contains the globbing pattern to exclude.

I install gnu tar on all of my systems in /usr/local/bin.  OpenBSD's tar
is in /bin, so specify path accordingly.

The command switches aren't quite compatible between the two tars, so I've
found it necessary to keep both on the system.  Ports come to mind as
something that failed because I tried using gnu tar instead of the stock
tar.  But the ability to specify the contents of an archive by file or
directory makes cloning a system so easy it is well worth it (IHMO).

Jeff Ross
Open Vistas Networking, Inc.
http://www.openvistas.net