按键精灵近期更新中正式推出原生Zip压缩文件命令,大幅简化文件压缩流程,提升脚本开发效率。
函数名称
Zip压缩文件
函数功能
压缩文件或文件夹并保存到指定目录
支持版本:安卓版v4.2.0、iOS旧版v1.6.6、iOS新版引擎v2.0.0或以上版本
函数语法
result = Zip(filePath,savePath[,password])
函数参数
| 参数名 | 参数类型 | 是否必选 | 参数说明 |
|---|---|---|---|
| filePath | string | 是 | 待压缩的文件或文件夹路径 |
| savePath | string | 是 | 压缩保存路径,暂只支持zip格式,如果压缩对象为文件夹,保存路径不能在待压缩文件夹下,以避免被递归 |
| password | string | 否 | 压缩密码 该参数支持版本:安卓版v4.2.0,iOS新版引擎v2.7.0或以上版本 |
函数返回
| 返回名 | 返回类型 | 返回说明 |
|---|---|---|
| result | bool | 执行结果,true:成功,false:失败 |
代码范例
Dim filePath,savePath,releasePath,password,result
filePath = "/mnt/shared/Pictures/test/"
savePath = "/mnt/shared/Pictures/test.zip"
releasePath = "/mnt/shared/Pictures/test1/"
password = "a123456"
TracePrint dir.Exist(filePath)
result = Zip(filePath, savePath, password)
TracePrint result
TracePrint dir.Exist(savePath)
result = UnZip(savePath, releasePath, password)
TracePrint result
TracePrint dir.Exist(releasePath)
1070

被折叠的 条评论
为什么被折叠?



