Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 09:19 PM
Peter Terpstra
 
Posts: n/a
Default exclude in tar command


Dear readers,

How can i exclude with the tar command a list of files ending
on .gz .deb .rpm .iso .zip an so on?

TIA!

Peter

--
mailtoeter@dharma.dyndns.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 09:19 PM
Brad Rogers
 
Posts: n/a
Default Re: exclude in tar command

On Thu, 21 Feb 2008 12:07:18 +0100, Peter Terpstra wrote:

>
> Dear readers,
>
> How can i exclude with the tar command a list of files ending
> on .gz .deb .rpm .iso .zip an so on?


tar --help gives (amongst other things);

--exclude=PATTERN exclude files, given as a PATTERN

--
Regards _
/ ) "The blindingly obvious is
/ _)rad never immediately apparent"

White people going to school, where they teach you to be thick
White Riot - The Clash
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 09:19 PM
Peter Terpstra
 
Posts: n/a
Default Re: exclude in tar command

Brad Rogers in <pan.2008.02.21.11.18.45.813936@abydos.stargate.or g.uk> :


> tar --help gives (amongst other things);
>
> --exclude=PATTERN * * *exclude files, given as a PATTERN


Yes i know, but how?

tar cvf --exclude="*.gz *.cf *.txt *.sh *.conf *.db" test.tar etc

Creates just a file with that name and ends in an error (tar: Error exit
delayed from previous errors).

P.

--
mailtoeter@dharma.dyndns.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 09:19 PM
Felix M. Palmen
 
Posts: n/a
Default Re: exclude in tar command

* Peter Terpstra <peter@dharma.dyndns.invalid>:
> Brad Rogers in <pan.2008.02.21.11.18.45.813936@abydos.stargate.or g.uk> :
>
>
>> tar --help gives (amongst other things);
>>
>> --exclude=PATTERN Â* Â* Â*exclude files, given as a PATTERN


That's not meant for multiple patterns.

> tar cvf --exclude="*.gz *.cf *.txt *.sh *.conf *.db" test.tar etc


Either use another option reading your patterns from a file or use
multiple --exclude options, one for each pattern.

--
Felix M. Palmen (Zirias) \ -PGP- <fmp@palmen.homeip.net> /"\ ASCII Ribbon
web: http://zirias.ath.cx/ \ http://zirias.ath.cx/pub.txt \ / Campaign
my open source projects: \ FP ED9B 62D0 BE39 32F9 2488 X Against HTML In
http://zirias.ath.cx/?pg=pro \ 5D0C 8177 9D80 5ECF F683 / \ Mail And News
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 09:19 PM
Martin Boening
 
Posts: n/a
Default Re: exclude in tar command

Hi there,

On 2008-02-21, Peter Terpstra <peter@dharma.dyndns.invalid> wrote:
>
> Yes i know, but how?
>
> tar cvf --exclude="*.gz *.cf *.txt *.sh *.conf *.db" test.tar etc
>
> Creates just a file with that name and ends in an error (tar: Error exit
> delayed from previous errors).
>
> P.


the cvf parameter for tar expects the file name of the archive to follow
the 'f' argument real close. ;-) All further options need to follow later,
e.g.
tar cvf test.tar --exclude="*.gz" etc

The cvf is "old style" argument use and after giving the command options in
that style, the arguments for thos options must follow directly after the
option string in the order the option string specifies. Another example
would be

tar cvbf 20 /dev/rmt0 ...

if a blocking factor is required for writing to tape for example.
Alternatively, you can, of course, use new style options in almost any
order you like:

tar --create --file=test.tar --exclude="*.gz" --verbose etc

The --exclude can only take one pattern, IIRC. So you might try to find a
pattern that matches everything you want to exclude, have several
--exclude options on the command line or create a file containing all
exclude patterns, on per line, and then exclude from that:
tar cvf test.tar --exclude-from=patternfile etc

HTH
Martin
--
Martin Boening, mboen@t-online.de, Linux Registered User #258205

KERNEL: A part of an operating system that preserves the medieval
traditions of sorcery and black art.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2008, 09:19 PM
Dan C
 
Posts: n/a
Default Re: exclude in tar command

On Thu, 21 Feb 2008 12:07:18 +0100, Peter Terpstra wrote:

> How can i exclude with the tar command a list of files ending
> on .gz .deb .rpm .iso .zip an so on?


man tar

> TIA!


HTH!


--
"Ubuntu" -- an African word, meaning "Slackware is too hard for me".

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-21-2008, 09:19 PM
Peter Terpstra
 
Posts: n/a
Default Re: exclude in tar command

Dan C in <pan.2008.02.21.15.21.32.288215@moria.lan> :

> man tar


I read the manpages for more than seven years now and i'm still not good at
them.

Peter

--
mailtoeter@dharma.dyndns.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-21-2008, 09:19 PM
Peter Terpstra
 
Posts: n/a
Default Re: exclude in tar command

Martin Boening in <fpk1qe$fpk$02$1@news.t-online.com> :

> The --exclude can only take one pattern, IIRC. So you might try to find a
> pattern that matches everything you want to exclude, have several
> --exclude options on the command line or create a file containing all
> exclude patterns, on per line, and then exclude from that:
> tar cvf test.tar --exclude-from=patternfile etc


Thank you very much, this was what i was looking for.

Peter

--
mailtoeter@dharma.dyndns.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-21-2008, 09:19 PM
Dan C
 
Posts: n/a
Default Re: exclude in tar command

On Thu, 21 Feb 2008 18:10:29 +0100, Peter Terpstra wrote:

>> man tar


> I read the manpages for more than seven years now and i'm still not good at
> them.


Seven years, eh? That's quite a while, especially for the 'tar' command.

Whatever you do, don't try reading the manpage for 'bash'. You might
explode.

At least you're trying. Keep after it.


--
"Ubuntu" -- an African word, meaning "Slackware is too hard for me".

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:43 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62