[CentOS] tar exclude command

Thu Jan 7 15:53:28 UTC 2010
"Fábio Jr." <fjuniorlista at gmail.com>

Hello,
>
> tar -cv --exclude '/var/named/chroot/proc/*' -zf backup.tar.gz /var/named
>   
I think this is the best way to use wildcards in expressions to avoid 
problems. ;)
>
>
> tar -cv --exclude /var/named/chroot/proc -zf backup.tar.gz /var/named
>   
Yes, it works, but it didn't create the proc folder inside the tar 
folder tree. Example:

Original folder tree:

- var
    |- named
       |- chroot
          |- proc
             |- garbage1.txt
             |- garbage2.txt
          |- foo
             |- test1.txt
             |- test2.txt
          |- bar
             |- test3.txt
             |- test4.txt

# tar -cv --exclude '/var/named/chroot/proc/*' -zf backup.tar.gz /var/named


Will keep this structure at backup.tar.gz

- var
    |- named
       |- chroot
          |- proc
          |- foo
             |- test1.txt
             |- test2.txt
          |- bar
             |- test3.txt
             |- test4.txt

tar -cv --exclude /var/named/chroot/proc -zf backup.tar.gz /var/named

Will save this structure at backup.tar.gz

- var
    |- named
       |- chroot
          |- foo
             |- test1.txt
             |- test2.txt
          |- bar
             |- test3.txt
             |- test4.txt

[]s


-- 
Fábio da Silva Júnior - fjuniorlista at gmail.com
----- http://fabioojunior.wordpress.com -----