[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tar -X piped to gzip

From: bturnip
Subject: tar -X piped to gzip
Date: Sun, 23 Oct 2005 20:16:39 -0500
User-agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)

I am having problems with the exclude (-X) option when using tar.  I am
trying to specifically exclude the RCS subdirectories (something similar
to the -F option for non-gnu tar).

Simple example:
I have a dir called px/, which has a subdir called 2005/.  I want to
create a tarball of all the files in the 2005/ folder *except* for the
RCS/ directory.

1st try:
$tar -cf - 2005/ | gzip > px2005.bkup.1023.tar.gz 
# No good, RCS dirs get needlessly backed up as well

2nd try
$tar -cf - 2005/ -X 2005/RCS | gzip > px2005.bkup.1023.tar.gz
$tar -cf - 2005/ -X 2005/RCS/ | gzip > px2005.bkup.1023.tar.gz
# No good, both options give the same error:
tar: 2005/RCS/: Is a directory
tar: Error is not recoverable: exiting now

3rd try
$tar -cf - 2005/ -X 2005/RCS/* | gzip > px2005.bkup.1023.tar.gz
# No good,makes the tar.gz, but the file is mangled

4th try, just make the tar file and just choose one file to exclude
$tar -cf px2005.bkup.1023.tar 2005/ -X 2005/RCS/constants.php,v 
# No good, tar file created but on extraction, constants.php,v is present

5th try, try a file w/o a comma, just for giggles 
$tar -cf px2005.bkup.1023.tar 2005/ -X 2005/index.php
# No good, tar file created, but on extraction, index.php is present

Any hints and suggestions appreciated.  Dash in the wrong place, order of
options presented wrong?  Correct the error of my ways, please!

$tar -cf - 2005/ -X 2005/RCS | gzip > px2005.bkup.1013.tar.gz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]