LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-12-2006, 05:33 PM   #1
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Rep: Reputation: 18
problems with tar --exclude


I'm trying to exclude a certain folder and its contents from an archive. I tried
Code:
$ tar --create --file="test.tar" --exclude="test/folder1" test
However, this not only excludes the file
Code:
./test/folder1
, but also other files matching that pattern, e.g.
Code:
./test/somefolder/test/folder1
Is there some way to exclude exactly this one file?
Giving the full pathname, as in
Code:
--exclude="/home/username/test/folder1
results in tar excluding nothing at all.

I already serarched the web and the tar manpages, but I did not find anything regarding that issue.

Any help is appreciated.
 
Old 09-12-2006, 08:15 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
First, read http://www.aoe.vt.edu/~lscharf/samd/...+tar+--exclude on the correct syntax for using tar with --exclude,

then read http://www.linuxtopia.org/online_boo...h-exclude.html, paying particular attention to the difference between --exclude and --exclude-from in the tar command.
 
Old 09-13-2006, 04:40 PM   #3
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 731

Rep: Reputation: 75
Hi, Lotharster.

Did you get your tar problem solved?

I looked at the references that bigrigdriver mentioned, because I like to know about good ones. It looks like the second one is an HTML of the info file. Not the easiest to understand, but that's *nix man and info pages for you, they're references, not tutorials. The better ones will at least include a few examples.

I'm hoping that you noticed that the exclusions are patterns, which can make for frustration at first, but prove to be very powerful.

Best wishes ... cheers, makyo
 
Old 09-15-2006, 08:03 AM   #4
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Original Poster
Rep: Reputation: 18
Thanks for your links.
I finally found what I was lookiong for. With the --anchored option, only the initial substring is matched.
 
  


Reply

Tags
tar


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar exclude from not working noir911 Linux - Software 5 08-05-2006 08:05 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 08:31 PM
tar --exclude-from=FILE GATTACA Programming 1 07-29-2005 01:25 PM
tar exclude-from drisay Slackware 1 12-23-2004 02:10 PM
tar --exclude for subdirectories mrtwice Linux - Software 2 10-23-2003 01:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:02 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