l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 May 27 11:32

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Question about Tar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Question about Tar

On Tue, 27 May 2003, Richard Crawford wrote:

> I've been trying to create a tar file which contains everything in our
> website except files in subdirectories called "message".

This description is ambiguous:

a) if the subdirectory is named "message", exclude all files in it and
   all files in all subdirectories of that directory?

b) in any subdirectory (not the current directory) ignore all files named

> First, I created an exclude file this way:
> # find . -type f -print | egrep 'message*' > dlcmessages

1) Because this is depending on egrep regular expressions rather than
   filename wildcard globbing, it would match strings like "messag",
   "message", "messageee", "whatevermessag", and so on, potentially
   leading to selecting filenames that you actually don't want to end up
   in the exclude list.

2) This output does not include any subdirectories named "message"
   because they are not plain files ("-type f").  This may not be a
   problem if your intended meaning was (b).

3) If your intended meaning was (b), then this will also grab files from
   the current directory, not just subdirectories.

> When I cat the dlcmessages file, I see all of the message files, so I
> assume it assembled the file properly.
> Now, I'm trying to run the tar command.  I've used this:
> # tar -cvf dlctar.tar --exclude-file=dlcmessages .

Do you mean "--exclude-from" option?

> It starts the process without any hiccups, but it doesn't appear to
> exclude the message files that I want to have excluded.

Since your tar syntax above is corrupt yet you say it worked, I suppose
this means you did use "--exclude-from".

There is quite a bit of documentation on "tar" in "info tar".  One thing
to note in the section on "exclude" options is that the patterns tar looks
for are file globbing patterns, not regexp (egrep) patterns. I would hope
this shouldn't make a difference in the absence of wildcard characters,
(as in your dlcexclude file) but it is something to be aware of.

> I've also tried
> # tar -cvfX dlctar.tar exclude .

"-X" is equivalent to "--exclude-from", but here you also use "exclude"
instead of "dlcmessages".  Assuming those two files are the same, there
should be no difference in effect, so something about your expectations
of this command needs to be clarified. Can you give an example directory
structure, with commands and output showing what expectations were not
met and what you wanted?

> with no success.
> According to the documentation I've read, including man tar, this *should*
> work, but it isn't.  What am I doing wrong?

Not sure.  Have you tried a "find"/"tar -T" inclusion approach?  The
exclusion approach ought to work, but breaking out of your box may
illuminate something.

Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.