Created
June 20, 2014 05:28
-
-
Save winse/6e60916d4ac369cf9430 to your computer and use it in GitHub Desktop.
tar解压(过滤)部分文件: --exclude=XXX, XXX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[hadoop@localhost tmp]$ tar zcvf test.tar.gz . | |
./ | |
./c/ | |
./c/1/ | |
./c/1/2/ | |
./b/ | |
./b/1/ | |
./b/1/2/ | |
./a/ | |
./a/1/ | |
./a/1/2/ | |
[hadoop@localhost tmp]$ ls | |
a b c test.tar.gz | |
[hadoop@localhost tmp]$ rm -rf ? | |
[hadoop@localhost tmp]$ ls -l | |
total 4 | |
-rw-rw-r--. 1 hadoop hadoop 195 Jun 20 21:04 test.tar.gz | |
[hadoop@localhost tmp]$ tar zxvf test.tar.gz --exclude=c/1 | |
./ | |
./c/ | |
./b/ | |
./b/1/ | |
./b/1/2/ | |
./a/ | |
./a/1/ | |
./a/1/2/ | |
[hadoop@localhost tmp]$ rm -rf ? | |
[hadoop@localhost tmp]$ ls -l | |
total 4 | |
-rw-rw-r--. 1 hadoop hadoop 195 Jun 20 21:04 test.tar.gz | |
[hadoop@localhost tmp]$ tar zxvf test.tar.gz a | |
tar: a: Not found in archive | |
tar: Exiting with failure status due to previous errors | |
[hadoop@localhost tmp]$ tar zxvf test.tar.gz ./a | |
./a/ | |
./a/1/ | |
./a/1/2/ | |
[hadoop@localhost tmp]$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment