0

I use

tar hczf t.tar.gz * --exclude="./test1"

where test1 is the name of a directory that I want to prevent from being tarred.

Unfortunately, tar still includes the directory test1. How can I have tar exclude directories?

1

So it turns out that to prevent the tarring of a directory you need to change where you're adding the --exclude

tar --exclude="./test1" -hczf t.tar.gz *

works

0

try...

tar hczf t.tar.gz * --exclude="test1"
  • tried that didn't work – Pota Onasys Dec 11 '15 at 19:27
  • I get the error tar: --exclude=test1: Cannot stat: No such file or directory – Pota Onasys Dec 11 '15 at 19:28
  • edited to include the 1 in test1 – soupmagnet Dec 11 '15 at 19:28
  • doesn't work either – Pota Onasys Dec 11 '15 at 19:29
  • then test1 doesn't exist in the current working directory – soupmagnet Dec 11 '15 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.