Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2012 11:51:27 -0700
From:      "Peter" <>
Subject:   tar --exclude not working
Message-ID:  <>

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

pkbsd:$find ./

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
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].


Want to link to this message? Use this URL: <>