如何使用 lzma sdk 压缩文件夹?
http://www.7-zip.org/sdk.html
我可以用它压缩文件,但找不到压缩文件夹的功能
http://www.7-zip.org/sdk.html
I can uses it compress a file, but can not find function of compress a Folder
您必须创建一个 .7z
存档,然后将文件夹的所有文件包含在其中.没有直接的文件夹"压缩:只是文件压缩.如果您在文件名中存储(相对)文件夹名称(例如文件夹名称文件名称"),则文件夹文件夹名称"将出现在存档中.
You'll have to create a .7z
archive, then include all files of the folder within. There is no direct "folder" compression: just compression of files. If you store a (relative) folder name within the file name (e.g. 'FolderNameFileName'), the folder 'FolderName' will appear within the archive.
您在 SDK 中有一个 ANSI-C 兼容源代码,用于 7z 解压示例.您必须对其进行调整以将文件夹的所有文件添加到存档中(使用 FindFirst/FindNext/FindClose
和递归,如果您希望包含子文件夹).
You have within the SDK a ANSI-C compatible source code for 7z decompression with example.
You'll have to adapt it to add all files of the folder to the archive (using FindFirst / FindNext / FindClose
and recursion if you want the sub-folder to be included).
事实上,sdk 中并没有 .7z 的写法.仅从 sdk 中的 .7z 存档中打开/提取.你必须手工编写代码......那么也许 使用 Delphi 的 7-Zip? 答案会在这里帮助你.
In fact, there is no .7z writing in the sdk. Only opening/extraction from a .7z archive within the sdk. You'll have to code it by hand... So perhaps the Using 7-Zip from Delphi? answer will help you here.