Search code examples
tarxz

Tar exclude hidden files but use relative paths?


Using the following command:

tar --exclude="./.*" -czvf /Volumes/Foo/2016-04-14_2051_full.tar.xz ./

Which follows this advice, still gets also hidden files archived:

a .
a ./.Trashes
a ./.fseventsd
a ./data

What can I do to only get the ./data folder archived?

Update: I use a Mac and zsh shell.


Solution

  • I now used the workaround:

    XZ_OPT=-9e tar --exclude='./old' --exclude='.*' -cJvf /Volumes/Foo/$(date +%Y%m%dT%H%M)_full.tar.xz * -g incremetal
    

    Hope it helps someone else as well