最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Mac中用zip压缩子文件夹

Mac crifan 4863浏览 0评论

搜:

mac zip 命令

参考:

mac Zip 常用命令 – sayALittle – 博客园

http://www.cnblogs.com/davidxie/archive/2012/11/23/2784646.html

Mac terminal 解压压缩 – Unintended – 博客园

http://www.cnblogs.com/bennman/p/3299749.html

Mac之zip unzip 命令(压缩) – CSDN博客

http://blog.csdn.net/yxys01/article/details/73848720

结果试了半天:

➜  http_summary git:(master) zip output.zip output

updating: output/ (stored 0%)

➜  http_summary git:(master) ll

total 64264

-rw-r–r–    1 crifan  staff   678B 12  6 17:24 README.md

-rw-r–r–    1 crifan  staff   2.9K 12  6 18:10 book.json

drwxr-xr-x  106 crifan  staff   3.3K 12  6 17:33 node_modules

drwxr-xr-x    7 crifan  staff   224B 12  6 18:11 output

-rw-r–r–    1 crifan  staff    31M 12  6 18:13 output.zip

drwxr-xr-x   10 crifan  staff   320B 12  1 15:32 src

➜  http_summary git:(master) zip output.zip output

  adding: output/ (stored 0%)

➜  http_summary git:(master) zip output.zip output/

  adding: output/ (stored 0%)

➜  http_summary git:(master) zip output.zip output/*

  adding: output/epub/ (stored 0%)

  adding: output/mobi/ (stored 0%)

  adding: output/pdf/ (stored 0%)

  adding: output/website/ (stored 0%)

都只是生成100多或600多KB的文件。不是我要的30多M的。

后来加上-r参数,表示子目录递归都压缩,才可以:

zip -r output.zip output

效果:

➜  http_summary git:(master) zip -r output.zip output

  adding: output/ (stored 0%)

  adding: output/.DS_Store (deflated 94%)

  adding: output/mobi/ (stored 0%)

  adding: output/mobi/http_summary.mobi (deflated 12%)

  adding: output/website/ (stored 0%)

  adding: output/website/appendix/ (stored 0%)

  adding: output/website/appendix/index.html (deflated 78%)

  adding: output/website/appendix/reference.html (deflated 76%)

  adding: output/website/appendix/good_tutorial.html (deflated 78%)

  adding: output/website/index.html (deflated 78%)

  adding: output/website/http_related/ (stored 0%)

  adding: output/website/http_related/index.html (deflated 78%)

  adding: output/website/http_related/ch1_http_tool_lib.html (deflated 77%)

  adding: output/website/http_related/ch3_http_note_summary.html (deflated 79%)

  adding: output/website/http_related/ch2_http_api_design.html (deflated 78%)

  adding: output/website/http_detail/ (stored 0%)

  adding: output/website/http_detail/index.html (deflated 78%)

  adding: output/website/http_detail/ch1_http_structure.html (deflated 77%)

  adding: output/website/http_detail/ch4_http_resp_status_code.html (deflated 77%)

  adding: output/website/http_detail/ch5_http_resp_data_format_json.html (deflated 79%)

  adding: output/website/http_detail/ch2_http_header.html (deflated 79%)

  adding: output/website/http_detail/ch3_http_req_param_encode.html (deflated 80%)

  adding: output/website/http_intro/ (stored 0%)

  adding: output/website/http_intro/index.html (deflated 78%)

  adding: output/website/http_intro/ch4_http_basic_logic.html (deflated 77%)

  adding: output/website/http_intro/ch3_http_internal_process.html (deflated 77%)

  adding: output/website/http_intro/ch1_http_learn_purpose.html (deflated 77%)

  adding: output/website/http_intro/ch2_http_intro.html (deflated 77%)

  adding: output/website/sitemap.xml (deflated 87%)

  adding: output/website/search_plus_index.json (deflated 61%)

  adding: output/website/gitbook/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-disqus/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-disqus/plugin.css (deflated 19%)

  adding: output/website/gitbook/gitbook-plugin-disqus/plugin.js (deflated 64%)

  adding: output/website/gitbook/images/ (stored 0%)

  adding: output/website/gitbook/images/favicon.ico (deflated 80%)

  adding: output/website/gitbook/images/apple-touch-icon-precomposed-152.png (deflated 5%)

  adding: output/website/gitbook/gitbook-plugin-expandable-chapters-small/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css (deflated 61%)

  adding: output/website/gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js (deflated 64%)

  adding: output/website/gitbook/gitbook-plugin-theme-comscore/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-theme-comscore/test.js (deflated 47%)

  adding: output/website/gitbook/gitbook-plugin-theme-comscore/test.css (deflated 44%)

  adding: output/website/gitbook/gitbook-plugin-alerts/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-alerts/style.css (deflated 67%)

  adding: output/website/gitbook/gitbook-plugin-alerts/plugin.js (deflated 63%)

  adding: output/website/gitbook/theme.js (deflated 65%)

  adding: output/website/gitbook/gitbook-plugin-search-plus/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-search-plus/search.css (deflated 69%)

  adding: output/website/gitbook/gitbook-plugin-search-plus/jquery.mark.min.js (deflated 64%)

  adding: output/website/gitbook/gitbook-plugin-search-plus/search.js (deflated 67%)

  adding: output/website/gitbook/gitbook.js (deflated 65%)

  adding: output/website/gitbook/gitbook-plugin-sharing-plus/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-sharing-plus/buttons.js (deflated 62%)

  adding: output/website/gitbook/gitbook-plugin-copy-code-button/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-copy-code-button/toggle.js (deflated 64%)

  adding: output/website/gitbook/style.css (deflated 80%)

  adding: output/website/gitbook/gitbook-plugin-github-buttons/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-github-buttons/plugin.js.map (deflated 71%)

  adding: output/website/gitbook/gitbook-plugin-github-buttons/plugin.js (deflated 72%)

  adding: output/website/gitbook/gitbook-plugin-donate/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-donate/plugin.css (deflated 80%)

  adding: output/website/gitbook/gitbook-plugin-donate/plugin.js (deflated 62%)

  adding: output/website/gitbook/gitbook-plugin-ga/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-ga/plugin.js (deflated 45%)

  adding: output/website/gitbook/gitbook-plugin-prism/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-duotone-light.css (deflated 63%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-ghcolors.css (deflated 65%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-hopscotch.css (deflated 55%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-duotone-forest.css (deflated 63%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-xonokai.css (deflated 65%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-atom-dark.css (deflated 58%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-vs.css (deflated 65%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-duotone-space.css (deflated 63%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-base16-ateliersulphurpool.light.css (deflated 64%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-duotone-sea.css (deflated 63%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-cb.css (deflated 61%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-duotone-dark.css (deflated 63%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-pojoaque.css (deflated 47%)

  adding: output/website/gitbook/gitbook-plugin-prism/prism-duotone-earth.css (deflated 63%)

  adding: output/website/gitbook/gitbook-plugin-toolbar-button/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-toolbar-button/plugin.js (deflated 51%)

  adding: output/website/gitbook/fonts/ (stored 0%)

  adding: output/website/gitbook/fonts/fontawesome/ (stored 0%)

  adding: output/website/gitbook/fonts/fontawesome/fontawesome-webfont.svg (deflated 69%)

  adding: output/website/gitbook/fonts/fontawesome/FontAwesome.otf (deflated 18%)

  adding: output/website/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 (deflated 0%)

  adding: output/website/gitbook/fonts/fontawesome/fontawesome-webfont.ttf (deflated 41%)

  adding: output/website/gitbook/fonts/fontawesome/fontawesome-webfont.woff (deflated 0%)

  adding: output/website/gitbook/fonts/fontawesome/fontawesome-webfont.eot (deflated 0%)

  adding: output/website/gitbook/gitbook-plugin-tbfed-pagefooter/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-tbfed-pagefooter/footer.css (deflated 38%)

  adding: output/website/gitbook/gitbook-plugin-splitter/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-splitter/splitter.js (deflated 68%)

  adding: output/website/gitbook/gitbook-plugin-splitter/splitter.css (deflated 55%)

  adding: output/website/gitbook/gitbook-plugin-fontsettings/ (stored 0%)

  adding: output/website/gitbook/gitbook-plugin-fontsettings/fontsettings.js (deflated 76%)

  adding: output/website/gitbook/gitbook-plugin-fontsettings/website.css (deflated 87%)

  adding: output/website/assets/ (stored 0%)

  adding: output/website/assets/favicon.ico (deflated 25%)

  adding: output/website/assets/img/ (stored 0%)

  adding: output/website/assets/img/http_range_download.png (deflated 3%)

  adding: output/website/assets/img/2F0FA94A-462F-49D5-8249-D7BFAE34CB76.png (deflated 1%)

  adding: output/website/assets/img/681BB8D6-73BC-4EAD-804E-4014E5C12299.png (deflated 3%)

  adding: output/website/assets/img/chrome_address_with_zhcn.png (deflated 1%)

  adding: output/website/assets/img/446072B2-ECCA-4D32-88C4-91CE64F85605.png (deflated 1%)

  adding: output/website/assets/img/1D928B86-A1C2-404B-A682-48332C1F71DF.png (deflated 1%)

  adding: output/website/assets/img/D980D429-8ED2-4EAF-92A0-EC1AAD7E542B.png (deflated 11%)

  adding: output/website/assets/img/9EED85A6-83B3-42DB-85D5-2B3B3E5F06A5.png (deflated 0%)

  adding: output/website/assets/img/0450D66D-6641-403F-BF7F-ED9496AD4A30.png (deflated 0%)

  adding: output/website/assets/img/7C86AF70-EADF-4E11-A766-12467A62C778.png (deflated 1%)

  adding: output/website/assets/img/61CD3BDE-03EF-48A8-811E-DE5572656473.png (deflated 13%)

  adding: output/website/assets/img/4DDE8C10-6593-4BFD-8BBC-A15A79698C25.png (deflated 10%)

  adding: output/website/assets/img/644015DB-FDF6-48F8-AB2C-E68C76C63AD8.png (deflated 1%)

  adding: output/website/assets/img/0E984231-A46A-49DA-AB4C-8B1B6859BCE2.png (deflated 4%)

  adding: output/website/assets/img/665389BA-F1E4-4A17-B2FF-BEF7E773DD8D.png (deflated 7%)

  adding: output/website/assets/img/B7221FAE-3275-4973-88BC-D4E79EB59875.png (deflated 1%)

  adding: output/website/assets/img/8495B70C-58BC-4786-940A-FC5834B12343.jpg (deflated 10%)

  adding: output/website/assets/img/38CFDEB6-8637-4C7C-AC2E-14C7F3AD9B5A.png (deflated 6%)

  adding: output/website/assets/img/BD4592BC-6401-4D12-B84C-F50CFB53A3FB.png (deflated 1%)

  adding: output/website/assets/img/4ACF224B-4768-406B-B28D-50F8131C38C4.png (deflated 8%)

  adding: output/website/assets/img/523C7AA5-AF8F-477A-A7CF-BA415AC37F8F.png (deflated 8%)

  adding: output/website/assets/img/58E15E6F-F862-4DFA-B248-EA981AB89FE6.png (deflated 1%)

  adding: output/website/assets/img/8BE31A06-4506-4265-B436-888B09223C51.png (deflated 1%)

  adding: output/website/assets/img/2B2421A4-B01C-49BA-B49F-607CD2E7A6C2.png (deflated 2%)

  adding: output/website/assets/img/2D3C5583-DE77-4BA8-A128-FCC1218B5FA8.png (deflated 8%)

  adding: output/website/assets/img/DB7AD0DA-1C42-4504-B8C5-D8DFCE4444A4.png (deflated 10%)

  adding: output/pdf/ (stored 0%)

  adding: output/pdf/http_summary.pdf (deflated 2%)

  adding: output/epub/ (stored 0%)

  adding: output/epub/http_summary.epub (deflated 0%)

➜  http_summary git:(master) ll

total 64240

-rw-r–r–    1 crifan  staff   678B 12  6 17:24 README.md

-rw-r–r–    1 crifan  staff   2.9K 12  6 18:10 book.json

drwxr-xr-x  106 crifan  staff   3.3K 12  6 17:33 node_modules

drwxr-xr-x    7 crifan  staff   224B 12  6 18:11 output

-rw-r–r–    1 crifan  staff    31M 12  6 18:15 output.zip

drwxr-xr-x   10 crifan  staff   320B 12  1 15:32 src

【总结】

Mac中用zip压缩子文件:

zip -r xxx.zip folderName

即可。

转载请注明:在路上 » 【已解决】Mac中用zip压缩子文件夹

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.198 seconds, using 22.13MB memory