I'm having a problem getting the tar command to work as advertised. I'm
migrating a drive's contents to a bigger drive and I'm tar'ring to STDOUT
then changing to the new directory to untar as in:
cd fromdir; tar cf - . | (cd todir; tar xpf -)
There is one directory that I do NOT want to copy to the new drive and,
according to the man page, you can use the exclude flag as in (taken
straight from the man page):
<snip>
tar cvf /tmp/mybackup.tar -e $HOME/zeugma $HOME
The preceding command line uses the f flag to create a tar archive named
mybackup.tar in the /tmp directory. The archive contains the user's
home directory and its contents, including all subdirectories and files
except the zeugma subdirectory and its contents, which are excluded by the -e
(exception) flag.
<snip>
This doesn't work!
My command looks exactly like this one except I'm using STDOUT as the
filename (-) and tar refuses to exclude the directory. I've tried quotes,
absolute paths to the directory, and wildcards--and none of them seem to
work. It always adds them to the archive anyway. How do I get it to
exclude this directory?! Here's my command (run from the 'contents' dir):
tar cvpf - . -e messages | ( cd /new_disk/contents ; tar xpf - )
-Ed Silver
Received on Wed Apr 05 2000 - 02:21:55 NZST