GNU tar "--transform" extract still creates empty original name top level directory

Viewed 9

My environment:

  • OS: MacOS Monterey 12.6
  • Tar: GNU Tar 1.34 installed using Homebrew (package gnu-tar)

I'm trying to extract the Helm chart directory from a GitHub repo using:

curl -s -L https://github.com/obsidiandynamics/kafdrop/archive/master.tar.gz | \
  tar --transform 's@^kafdrop-master/chart/@kafdrop-chart/@' -zxvf - \
  --show-transformed-names kafdrop-master/chart
kafdrop-master/chart/
kafdrop-chart/.helmignore
kafdrop-chart/Chart.yaml
kafdrop-chart/templates/
kafdrop-chart/templates/NOTES.txt
kafdrop-chart/templates/_helpers.tpl
kafdrop-chart/templates/deployment.yaml
kafdrop-chart/templates/ingress.yaml
kafdrop-chart/templates/service.yaml
kafdrop-chart/values.yaml

GNU tar does the right thing an extracts the files under the requested kafdrop-chart directory.

But it also creates an empty kafdrop-master/chart directory.

The question: how can I tell GNU tar not to create the empty kafdrop-master/chart and kafdrop-master?

0 Answers
Related