This is driving me crazy. I want to tar
a directory, but exclude some files. This is my command:
tar -zcvf $NAME-$VERSION.tar.gz $NAME-$VERSION --exclude='.git' --exclude='.gitignore'
While the above command works on RedHat EL5, it doesn't work on Mac OS 10.8.2. I have tried replacing the '
with "
, \'
and \"
. I have tried removing the equal signs. Nothing works.
What am I doing wrong?
Best Answer
All the options need to be together before the arguments, and the
-f
flag needs to precede the tar file: