我注意到,在命令行“拉链”的工具和Mac OS X的“压缩XXX”选项(通过取景器中右键点击可)是给不同的输出文件。 不仅是文件中的几百个字节更大的尺寸,但内容是显著不同的。
我怎样才能找出命令Finder是使用压缩?
我注意到,在命令行“拉链”的工具和Mac OS X的“压缩XXX”选项(通过取景器中右键点击可)是给不同的输出文件。 不仅是文件中的几百个字节更大的尺寸,但内容是显著不同的。
我怎样才能找出命令Finder是使用压缩?
看看一个AppleScript压缩一个Finder选择的文章。
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
答案是man ditto
:
The command:
ditto -c -k --sequesterRsrc --keepParent src_directory archive.zip
will create a PKZip archive similarly to the Finder's Compress function-
ality.