Tar Exclude?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bart Garst
Date:  
Subject: Tar Exclude?
tar -zcvf mytarfile.tgz ~/backup --exclude ~/backup/notme

This will add all the contents of ~/backup except the directory
~/backup/notme to the tarfile.

I know this works. I use it in my backup scripts all the time.

Bart


>>>

Could someone give me some pointers on the "--exclude" option for 'tar'?
Specifically, the --exclude option only seems to exclude files and will
not exclude entire directories. Any pointers on how to make it work for
entire directories?

For example, the following commands will *not* work:

tar cv --exclude=/var/tmp/directory-to-exclude -f var.tar /var
tar cv --exclude=/var/tmp/directory-to-exclude/* -f var.tar /var

It seems that 'tar' wants me to list every single specific file to be
excluded. This is a problem because the to-be-excluded directory has
thousands of files, subdirectories, etc, etc, etc... Any clues?

BTW, I am aware of the "--exclude-file" option too, but this won't work
because many of the files in the to-be-excluded directory are constantly
changing and there are new files constantly being added/removed. Thus, I
can't really feed it a 'ls' output because there are always new files
getting added/removed.

Any pointers? Thanks!



--

== Jay Jacobson
== Edgeos, Inc. -- http://www.edgeos.com
==
== Automated Information Security and Vulnerability Assessment


---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss