Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exclude-file 'tar' ignores wildcards

146 views
Skip to first unread message

Wim.Van...@rug.ac.be

unread,
Feb 7, 2001, 7:51:07 AM2/7/01
to

Hello,

I use Solaris 2.8 on a Sun UltraSparc Workstation. I have troubles with
the 'tar' archiving command.
The 'tar' command is given in my home directory as follows:

tar cvfX mecanero.tar exclude.txt -C /export/work/wim/samcef .

This command should archive the contents of the directory
/export/work/wim/samcef and its subdirectories into the 'tar'-file
"mecanero.tar" and the files listed in "exclude.txt" should be excluded.
When I put the file "tension.f" in the exclude.txt file, the file is
indeed excluded with the following message (from the verbose output):

a ./tension.f excluded

However when I put the line

./tension.*

in the exclude.txt file, the file tension.f is yet included. I have
tried all sorts of combinations

*tension*
tension.*
./tension.*
./tension*

but none of them works. It seems that 'tar' simply ignores the wildcard
character.
Can anybody help ?

Wim Van Paepegem
Wim.Van...@rug.ac.be


Sent via Deja.com
http://www.deja.com/

Tony Walton

unread,
Feb 7, 2001, 8:08:52 AM2/7/01
to
Wim.Van...@rug.ac.be wrote:
>
> Hello,
>
> I use Solaris 2.8 on a Sun UltraSparc Workstation. I have troubles with
> the 'tar' archiving command.
{snip}

> when I put the line
>
> ./tension.*
>
> in the exclude.txt file, the file tension.f is yet included. I have
> tried all sorts of combinations
>
> *tension*
> tension.*
> ./tension.*
> ./tension*
>
> but none of them works. It seems that 'tar' simply ignores the wildcard
> character.


Correct. Wildcard characters such as * are expanded by the shell. Tar
is not a shell, and should not be expected to expand wildcard
characters. An exclude file containing

./tension.*

would exclude a single file called (exactly) "tension.*" in the current
directory, and nothing else.

--
Tony

This posting does not constitute official support from Sun Microsystems

stuart_abra...@yahoo.com

unread,
Feb 7, 2001, 9:07:11 AM2/7/01
to
Hi,
the exclude file can only take a single arg per line - the wildcard
expands it to more than one which is why it doesn't work.
You could do an ls tens* >>excfile prior to doing the tar..
Best Regards
Stuart
In article <95rgbp$8ps$1...@nnrp1.deja.com>,

Joerg Schilling

unread,
Feb 7, 2001, 12:31:59 PM2/7/01
to
In article <3A8148E4...@uk.sun.com>,

Tony Walton <tony....@uk.sun.com> wrote:
>Wim.Van...@rug.ac.be wrote:
>>
>> Hello,
>>
>> I use Solaris 2.8 on a Sun UltraSparc Workstation. I have troubles with
>> the 'tar' archiving command.
>{snip}
>
>> when I put the line
>>
>> ./tension.*
>>
>> in the exclude.txt file, the file tension.f is yet included. I have
>> tried all sorts of combinations
>
>Correct. Wildcard characters such as * are expanded by the shell. Tar
>is not a shell, and should not be expected to expand wildcard
>characters. An exclude file containing
>
>./tension.*
>
>would exclude a single file called (exactly) "tension.*" in the current
>directory, and nothing else.

Star does this:

star -c -V pat=tension.* .

would do this. You may have up to 100 patterns....

ftp://ftp.fokus.gmd.de/pub/unix/star/alpha/

--
EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
j...@cs.tu-berlin.de (uni) If you don't have iso-8859-1
schi...@fokus.gmd.de (work) chars I am J"org Schilling
URL: http://www.fokus.gmd.de/usr/schilling ftp://ftp.fokus.gmd.de/pub/unix

0 new messages