and*_*.46 2 command-line zip unzip decompression 16.04
作为 Xenial Xerus 上脚本化软件安装的一部分,我有一个名为“test.zip”的压缩档案,其中包含一个子目录中的一些文件,其中包括samples
:
andrew@athens:~/Desktop$ unzip -l test.zip
Archive: test.zip
Length Date Time Name
--------- ---------- ----- ----
0 2016-09-15 13:29 materials/
66 2014-11-16 18:22 materials/preferences.kcfgc
21554 2014-11-16 18:22 materials/mainwindow.cpp
166 2016-09-15 13:29 materials/.zip
164 2014-11-16 18:22 materials/Messages.sh
0 2016-09-15 13:28 samples/
35147 2014-11-16 18:22 samples/LICENCE
631 2014-11-16 18:22 samples/README.md
2344 2014-11-16 18:22 samples/main.cpp
--------- -------
60072 9 files
andrew@athens:~/Desktop$
Run Code Online (Sandbox Code Playgroud)
使用Xenial Xerus的命令行unzip
工具我怎么提取内容只的samples
,他们减压至/tmp
?
该命令将使用文件夹名称进行提取(默认行为):
unzip test.zip samples/* -d /tmp
Run Code Online (Sandbox Code Playgroud)
没有文件夹名称(提取仅包含在示例文件夹中的文件):
unzip -j test.zip samples/* -d /tmp
Run Code Online (Sandbox Code Playgroud)
来自man unzip
:
-j junk paths. The archive's directory structure is not recreated;
all files are deposited in the extraction directory (by default,
the current one).
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!