LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-02-2009, 11:51 AM   #1
BassKozz
Member
 
Registered: Dec 2008
Distribution: Ubuntu 8.10
Posts: 35

Rep: Reputation: 15
Unhappy [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} ./*

Last edited by BassKozz; 06-02-2009 at 12:00 PM. Reason: solved
 
Old 06-03-2009, 03:41 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,335
Blog Entries: 55

Rep: Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535
Good to see you fixed things yourself and posted the fix.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to exclude a Directory with TAR fw12 Linux - Software 3 03-28-2008 04:43 AM
tar --exclude-from=files command not working cucolin@ Linux - Server 2 04-03-2007 09:33 PM
tar exclude from not working noir911 Linux - Software 5 08-05-2006 07:05 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
tar exclude-from drisay Slackware 1 12-23-2004 01:10 PM


All times are GMT -5. The time now is 01:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration