函数:ts.ftp.rename 重命名文件

函数名称:重命名文件

函数功能:重命名服务器上指定目录的文件

函数方法

status = ts.ftp.rename(oldfilepath,newfilepath);

参数 类型 必填 说明
oldfilepath string 待重命名文件名
filePath string 新文件名
返回值 类型 说明
status boolean true - 重命名成功,false - 重命名失败

函数用例

--脚本仅供参考不可直接使用
local ts = require("ts")--使用官方库前一定要在开头插入这一句
status = ts.ftp.connect("111.111.11.151","username","password") 
if status then
    dialog("连接成功", 0)
else
    dialog("连接失败", 0)
end
status = ts.ftp.rename("/haha/test1","/haha/test2")
if status then
    dialog("修改成功")
else
    dialog("修改失败")
end
ts.ftp.close()  --操作完成后,断开 FTP 服务器连接

注意事项

  • 新、旧文件路径层级数必须相同

  • 新、旧文件夹路径必须是同一目录

Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""