我想在我正在编写的应用程序中使用 Archive Utility.app 来压缩一个或多个文件。
做(从命令行):
/System/Library/CoreServices/Archive\ Utility.app/Contents/MacOS/Archive\ Utility file_to_zip
确实有效,但它会创建一个 cpgz 文件,我可以接受(即使 .zip 会更好)但主要问题是我无法将 2 个文件压缩到 1 个存档中:
/System/Library/CoreServices/Archive\ Utility.app/Contents/MacOS/Archive\ Utility ~/foo/a.txt ~/bar/b.txt
上述命令将创建 2 个存档(~/foo/a.txt.cpgz 和 ~/bar/b.txt.cpgz)。
我也不能让它做我想做的事:
open -a /System/Library/CoreServices/Archive\ Utility.app --args xxxx
我宁愿不使用 zip 命令,因为要压缩的文件相当大,所以有内置的进度条会很整洁。
或者,我可以以编程方式使用存档实用程序吗?
谢谢。