I'm trying to perform a full backup of a Linux server using GNU-Tar. The file system looks like this:
├── backup
├── data
│ ├── d1
│ ├── d2
│ └── tmp
│ ├── tt1
│ ├── tt2
│ └── tt3
├── exclude
├── home
│ ├── a
│ ├── b
│ ├── c
│ └── d
├── proc
│ ├── pa
│ ├── pb
│ ├── pc
│ └── pd
├── sys
│ ├── s1
│ ├── s2
│ ├── s3
│ └── s4
└── tmp
├── t1
├── t2
└── t3
I'd like to exclude tmp and proc, but preserve /data/tmp/*. However, using the following command:
$tar -X exclude -cvpf - * | wc -l
with this exclude file:
$cat exclude
proc/*
tmp/*
I find that /data/tmp is excluded as well. How can I include data/tmp whilst excluding tmp? More importantly, how should I understand tar's wildcard interpretation and exclude pattern matching. Does every pattern in the exclude file behave like a grep?
Thanks!
