![zip 解压,使用 `-d` 忽略一级 zip 文件夹结构 (CLI)](https://linux22.com/image/1005400/zip%20%E8%A7%A3%E5%8E%8B%EF%BC%8C%E4%BD%BF%E7%94%A8%20%60-d%60%20%E5%BF%BD%E7%95%A5%E4%B8%80%E7%BA%A7%20zip%20%E6%96%87%E4%BB%B6%E5%A4%B9%E7%BB%93%E6%9E%84%20(CLI).png)
My_big_zip_file.zip
我有一个具有以下文件结构的文件:
unzip -l My_big_zip_file.zip
产量:
Archive: My_big_zip_file.zip
Length Date Time Name
--------- ---------- ----- ----
155274931 2018-01-16 14:30 My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201501).zip
96693995 2018-01-16 13:50 My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201403).zip
113751167 2018-01-16 14:10 My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201409).zip
158758696 2018-01-16 14:16 My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201410).zip
140706108 2018-01-16 13:24 My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201308).zip
142957976 2018-01-16 14:51 My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201505).zip
--------- -------
808142873 6 files
我想把这些内容全部解压出来,/results/
但是当我运行
unzip My_big_zip_file.zip -d results
我收到一个不需要的文件夹级别:
inflating: results/My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201501).zip
inflating: results/My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201403).zip
inflating: results/My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201409).zip
inflating: results/My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201410).zip
inflating: results/My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201308).zip
inflating: results/My_big_zip_file/Level1_BasicFile_ProductID(254)_Date(201505).zip
那么如何避免My_big_zip_file/
在输出路径中出现?例如使结果为:
results/Level1_BasicFile_ProductID(254)_Date(201501).zip
results/Level1_BasicFile_ProductID(254)_Date(201403).zip
results/Level1_BasicFile_ProductID(254)_Date(201409).zip
results/Level1_BasicFile_ProductID(254)_Date(201410).zip
results/Level1_BasicFile_ProductID(254)_Date(201308).zip
results/Level1_BasicFile_ProductID(254)_Date(201505).zip