> 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,
[EMAIL PROTECTED]

Attachment: msg02412/pgp00000.pgp
Description: PGP signature

Reply via email to