How to create a zip file in the same format as the Finder's “Compress” menu item?

后端 未结 4 1735
青春惊慌失措
青春惊慌失措 2020-12-15 16:06

On Mac OS X, you can create a zip archive from the Finder by selecting some files and selecting \"Compress\" from the contextual menu or the File menu. Unfortunately, the r

相关标签:
4条回答
  • 2020-12-15 16:43

    man ditto states:

     The command:
           ditto -c -k --sequesterRsrc --keepParent src_directory archive.zip
     will create a PKZip archive similarly to the Finder's Compress functionality.
    

    notice --keepParent

    0 讨论(0)
  • 2020-12-15 16:50

    I have a ruby script that makes iPhone App Store builds for me, but the zips it was generating wouldn't get accepted by iTunes Connect. They were accepted if I used Finder's "Compress" function.

    millenomi's answer came close for me, but this command is what ended up working. iTunes Connect accepted my build, and the app got approved and can be downloaded no problem, so it's tested.

    ditto -c -k --sequesterRsrc --keepParent AppName.app AppName.zip
    
    0 讨论(0)
  • 2020-12-15 16:56

    Use the ditto command-line tool as follows:

    ditto -ck --rsrc --sequesterRsrc folder file.zip
    

    See the ditto man page for more.

    0 讨论(0)
  • 2020-12-15 17:07

    The clue's in the tag 'automation'.

    Create an action in Automator.app that uses the 'Create Archive' action, invoke it from the command-line (see 'automator').

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