Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 09-12-2006, 04:33 PM   #1
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
$ tar --create --file="test.tar" --exclude="test/folder1" test
However, this not only excludes the file
, but also other files matching that pattern, e.g.
Is there some way to exclude exactly this one file?
Giving the full pathname, as in
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, 07:15 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
First, read on the correct syntax for using tar with --exclude,

then read, paying particular attention to the difference between --exclude and --exclude-from in the tar command.
Old 09-13-2006, 03:40 PM   #3
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 732

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, 07:03 AM   #4
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.



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 07:05 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
tar --exclude-from=FILE GATTACA Programming 1 07-29-2005 12:25 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 > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:40 AM.

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