The following simple command yield the following result:

$ tar -zcvf clusterops.tgz ansible --exclude='.git' --exclude='.idea' --exclude='**/.ssh' --exclude='*.log' | grep ssh

What is going on here? Why the pattern '**/.ssh' fail to do anything?

  • 4
    At least for GNU tar, AFAIK it only supports "a glob(3)-style wildcard pattern" whereas you appear to be trying to use a "globstar" pattern similar to that provided by some shells - see for example Recursive glob? – steeldriver Mar 24 '18 at 21:36
  • In effect, you are telling the command to exclude a file called .ssh located in any directory within the archive. Instead, use --exclude='*/.ssh/*' – Nasir Riley Mar 25 '18 at 2:02

Your Answer

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

Browse other questions tagged or ask your own question.