Mac OS X的“压缩"选项与命令行zip(为什么会产生不同的结果?) [英] Mac OS X 'compress' option vs command line zip (why do they produce different results?)

查看:321
本文介绍了Mac OS X的“压缩"选项与命令行zip(为什么会产生不同的结果?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到命令行"zip"工具和Mac OS X的"Compress XXX"选项(可通过在Finder中右键单击获得)提供了不同的输出文件.不仅文件的大小大了几百个字节,而且内容也大不相同.

I noticed that the command line 'zip' tool and Mac OS X's 'Compress XXX' option (available via right click in finder) are giving different output files. Not only is the size of the file a few hundred bytes bigger but the content is significantly different as well.

如何找出Finder用于压缩的命令?

How can I find out what command the Finder is using for compression?

推荐答案

看看用于压缩Finder选择项的AppleScript 文章.

try
    tell application "Finder"
        set theSelection to the selection
        set selectionCount to count of theSelection
        if selectionCount is greater than 1 then
            error "Please select only one Finder item before running this script."
        else if selectionCount is less than 1 then
            error "Please select one Finder item before running this script."
        else
            set theItem to (item 1 of theSelection) as alias
            set destFolder to (container of theItem) as alias
            set itemName to name of theItem
        end if
    end tell

    do shell script ("ditto -c -k --sequesterRsrc --keepParent " & quoted form of POSIX path of theItem & space & quoted form of (POSIX path of destFolder & itemName & ".zip"))
on error theError
    tell me
        activate
        display dialog "Error: " & theError buttons {"OK"} default button 1 with icon stop
    end tell
end try

这篇关于Mac OS X的“压缩"选项与命令行zip(为什么会产生不同的结果?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆