Mac zip compress without __MACOSX folder?

后端 未结 14 1488
有刺的猬
有刺的猬 2020-12-07 06:53

When I compress files with the built in zip compressor in Mac OSX, it results in an extra folder titled \"__MACOSX\" created in the extracted zip.

Can I adjust my se

相关标签:
14条回答
  • 2020-12-07 07:28

    I have a better solution after read all of the existed answers. Everything could done by a workflow in a single right click. NO additional software, NO complicated command line stuffs and NO shell tricks.

    The automator workflow:

    • Input: files or folders from any application.
    • Step 1: Create Archive, the system builtin with default parameters.
    • Step 2: Run Shell command, with input as parameters. Copy command below.

      zip -d "$@" "__MACOSX/*" || true

      zip -d "$@" "*/.DS_Store" || true

    Save it and we are done! Just right click folder or bulk of files and choose workflow from services menu. Archive with no metadata will be created alongside.

    0 讨论(0)
  • 2020-12-07 07:31

    Inside the folder you want to be compressed, in terminal:

    zip -r -X Archive.zip *
    

    Where -X means: Exclude those invisible Mac resource files such as “_MACOSX” or “._Filename” and .ds store files

    source

    Note: Will only work for the folder and subsequent folder tree you are in and has to have the * wildcard.

    0 讨论(0)
提交回复
热议问题