LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar exclude HELP (https://www.linuxquestions.org/questions/linux-newbie-8/tar-exclude-help-730182/)

BassKozz 06-02-2009 11:51 AM

[solved] tar exclude HELP
 
I can't get exclude to work right, I am pulling my hair out...

Code:

#!/bin/sh
DESTINATION="/home/user/backups/"
CACHE="/home/user/foo/var/cache/*"
tar -cvpzf ${DESTINATION} --exclude=${CACHE} ./*

What am I doing wrong here? It still tar's up the CACHE directory and subdirectories within var/cache.


Edit:

Nevermind I figured it out I needed to use "var/cache/*" instead of the full path because I was already planted in "/home/user/foo"

Like so:
Code:

#!/bin/sh
DESTINATION="/home/user/backups/"
CACHE="var/cache/*"
tar -cvpzf ${DESTINATION} --exclude=${CACHE} ./*


unSpawn 06-03-2009 03:41 AM

Good to see you fixed things yourself and posted the fix.


All times are GMT -5. The time now is 06:16 AM.