tar question

Ryan Golhar golharam at umdnj.edu
Thu Oct 6 19:37:00 UTC 2005


Thanks for your help guys.

As it turns out, I just needed to remove the first / from the path, so
my command looks like:

# tar cvf backup.tar --exclude=home/tempuser/work /home/tempuser

That does the trick.

Ryan


-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of David Tonhofer,
m-plify S.A.
Sent: Thursday, October 06, 2005 2:54 PM
To: General Red Hat Linux discussion list
Subject: RE: tar question


> Please look at the tar line closer:

Um...right. My bad. Comes from doing two things at a time.

> My version of tar is 1.13.25, plus I'm also using the '=' in my 
> exclude. It is possible that they changed how exclude works in the 
> newer version of tar.

Nah, I don't think so. The difference comes from the fact that you use a
a relative path to state the stuff to include, whereas I use an absolute
path. Let's make this definitive statement and call it quits for today
as the beer awaits. Apparently "exclude" does not 100% respect the
principle of least astonishment:


cd /

# CASE 1:

tar -zcf out1.tgz --exclude=etc/sysconfig   etc
-> the archive contains relative paths
-> etc/sysconfig has been excluded
   (parameter matches archive path)

# CASE 2:

tar -zcf out2.tgz --exclude=/etc/sysconfig  etc
-> the archive contains relative paths
-> etc/sysconfig has NOT been excluded!
   (parameter does not match archive path)

# CASE 3:

tar -zcf out3.tgz --exclude=etc/sysconfig   /etc
-> the archive contains relative paths, as the leading '/' is stripped
   tar says "Removing leading `/' from member names"
   (a Good Thing as you can then untar anywhere)
-> etc/sysconfig has been excluded
   (parameter matches archive path)

# CASE 4:

tar -zcf out4.tgz --exclude=/etc/sysconfig  /etc
-> the archive contains relative paths, as the leading '/' is stripped
   tar says "Removing leading `/' from member names"
   (a Good Thing as you can then untar anywhere)
-> etc/sysconfig HAS BEEN excluded
   (even though parameter does not match archive path)



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list