All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Smith <sos22@cam.ac.uk>
To: Paul Kraus <pkraus@pelsupply.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: Tar Exclude
Date: Wed, 13 Nov 2002 17:11:06 +0000	[thread overview]
Message-ID: <20021113171106.GA1287@cam.ac.uk> (raw)
In-Reply-To: <077901c28b27$c6fd7540$64fea8c0@pkrausxp>

[-- Attachment #1: Type: text/plain, Size: 974 bytes --]

> I have a script that tars a all the sub directories of a directory into
> individual tar files for each subdirectory. I have an exclude file that
> is set to skip some of the folders I don't want tarred. This works but
> it creates the empty tar files. Is this normal?
Yes.  It is, in fact, exactly what you've told tar to do: create
a tar file containg everything in directory foo, excluding files
in directory foo.  This gives us an empty tar file.

> Can it be set not to do this?
I can't see any immediately obvious way to stop tar making empty
files, but you could try a script like this:

tar --create ... # Whatever arguments you're currently using for tar.
[ `tar -tf foo.tar | wc -l` -eq 0 ] && rm foo.tar

replacing foo.tar with the filename of the generated tarball which
might be empty.  (The second line checks whether the tar file is
empty, and rm-s it if it is).

This isn't a terribly pleasant solution, but it should work.

Steven Smith,
sos22@cam.ac.uk.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2002-11-13 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-13 15:17 Tar Exclude Paul Kraus
2002-11-13 15:22 ` Mike Dresser
2002-11-13 15:25   ` Paul Kraus
2002-11-13 17:11 ` Steven Smith [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-13 15:31 Paul Kraus
2002-11-13 15:51 ` Mike Dresser
2002-11-14  0:46 ` dashielljt
     [not found] <078901c28b2c$aa2664e0$64fea8c0@pkrausxp>
2002-11-13 15:59 ` Mike Dresser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021113171106.GA1287@cam.ac.uk \
    --to=sos22@cam.ac.uk \
    --cc=linux-newbie@vger.kernel.org \
    --cc=pkraus@pelsupply.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.