移動中控檔案/目錄 (LCC.web_file.move)
聲明
ok, err = LCC.web_file.move(src, target, mode?, timeout?)
參數
- src
字串型,來源路徑 - target
字串型,目標路徑 - mode
字串型,可選;移動模式,預設"normal",支援"overwrite"/"merge"/"overwrite-merge" - timeout
數值型,可選;請求逾時時間(秒),預設60
回傳值
- ok
布林值,成功傳回true,失敗傳回nil - err
字串型或nil,失敗時的錯誤描述
說明
移動檔案或目錄,也可用於重新命名或調整目錄結構。
當src是符號連結時,移動的是連結本體,不會改寫或刪除其目標內容。
normal模式下目標已存在則失敗;其他模式行為與同名便捷函數一致。
範例
local ok, err = LCC.web_file.move("/腳本/temp.lua", "/腳本/main.lua", "overwrite")
if not ok then
error(err)
end