Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2012 11:51:27 -0700
From:      "Peter" <fbsdq@peterk.org>
To:        freebsd-questions@freebsd.org
Subject:   tar --exclude not working
Message-ID:  <836b68e817a2b27b77ab82dbfadf45ca.squirrel@pop.pknet.net>

Next in thread | Raw E-Mail | Index | Archive | Help
Hello,
  Ran into a weird issue where the 'exclude' pattern to tar isn't matching
correctly:

pkbsd:$find ./
./
./file
./dir1
./dir1/file
./dir2
./dir2/file

This is expected:
pkbsd:$tar Jcvf /tmp/tar.test ./
a .
a ./file
a ./dir1
a ./dir2
a ./dir2/file
a ./dir1/file


This is correct:
pkbsd:$tar --exclude './dir2/file' -Jcvf /tmp/tar.test ./
a .
a ./file
a ./dir1
a ./dir2
a ./dir1/file

Here I want to _only_ exlude './file', NOT ./dir?/file
pkbsd:$tar --exclude './file' -Jcvf /tmp/tar.test ./
a .
a ./dir1
a ./dir2

Anyway to exclude just './file' ?

If I specify full path, it works as expected:
pkbsd:$tar --exclude "home/peter/t/blah/file" -Jcvf /tmp/tar.test
/home/peter/t/blah
tar: Removing leading '/' from member names
a home/peter/t/blah
a home/peter/t/blah/dir1
a home/peter/t/blah/dir2
a home/peter/t/blah/dir2/file
a home/peter/t/blah/dir1/file

Why not relative './file' ?  ['\./file' also does not work].

]Peter[




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?836b68e817a2b27b77ab82dbfadf45ca.squirrel>