Skip to content

Instantly share code, notes, and snippets.

@naoyes
Created February 11, 2014 09:43
Show Gist options
  • Select an option

  • Save naoyes/8931919 to your computer and use it in GitHub Desktop.

Select an option

Save naoyes/8931919 to your computer and use it in GitHub Desktop.
tar(1) でアーカイブ前の名前ではなく新たな名前のディレクトリで展開したいときのメモ ref: http://qiita.com/naoyes/items/a218a137b1a978ef59ce
$ mkdir after2 && tar xzvf dummy.tgz -C after2 --strip-components 2
before/one/two1
before/one/two/
before/one/two/three/
$ tree after2
after2
├── two
│   └── three
└── two1
2 directories, 1 file
-C, --directory=DIR
change to directory DIR
--strip-components=NUMBER
strip NUMBER leading components from file names on extraction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment