LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-04-2009, 11:58 AM   #1
windstory
Member
 
Registered: Nov 2008
Posts: 486

Rep: Reputation: 36
tar --exclude problem


My box is centos 5.3 x86.
I want to back up my data by incremental tar method, so searched some documents at google.

I've tried this command, but "--exclude" option does not work.

Code:
#!/bin/bash
checkdate=`LC_TIME=en date | awk '{print $1}'`

BACKUP_DIR=/_backup
html_SOURCE=/var/www/html/server1
dmdata_SOURCE=/var/www/html/server1/data

tar -g ${BACKUP_DIR}/html_fullincre_bak.list -czvpf ${BACKUP_DIR}/html_full_bak_${DATE}.tgz -C / ./${html_SOURCE} --exclude ${html_SOURCE}/data
Please let me know what is wrong.
Any comment would be appreciated.
 
Old 12-04-2009, 12:14 PM   #2
darenw
Member
 
Registered: Mar 2009
Location: Very humid Central Florida
Distribution: ArchLinux
Posts: 30

Rep: Reputation: 1
I think --exclude wants a filename (or pattern) not just a directory. If ${html_SOURCE}/data is a directory, make it --exclude ${html_SOURCE}/data/* and see if that works.
 
Old 12-04-2009, 03:14 PM   #3
windstory
Member
 
Registered: Nov 2008
Posts: 486

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by darenw View Post
I think --exclude wants a filename (or pattern) not just a directory. If ${html_SOURCE}/data is a directory, make it --exclude ${html_SOURCE}/data/* and see if that works.
darenw/
Thank you for your knidness.

But your advise does not work.

I've solved this problem with this command.

Code:
tar -g ${BACKUP_DIR}/html_fullincre_bak.list -czvpf ${BACKUP_DIR}/html_full_bak_${DATE}.tgz -C / ${html_SOURCE} --exclude ${html_SOURCE}/data
 
  


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
tar exclude HELP BassKozz Linux - Newbie 1 06-03-2009 03:41 AM
How to exclude a Directory with TAR fw12 Linux - Software 3 03-28-2008 04:43 AM
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
tar --exclude for subdirectories mrtwice Linux - Software 2 10-23-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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