Copy Files Or Directories (LCC.web_file.copy)
Signature
ok, err = LCC.web_file.copy(src, target, mode?, timeout?)
Parameters
- src
String. Source path. - target
String. Destination path. - mode
String, optional. Copy mode, default"normal"; supports"overwrite","merge","overwrite-merge". - timeout
Number, optional. Request timeout in seconds, default60.
Returns
- ok
Boolean.trueon success,nilon failure. - err
String ornil. Error description when the copy fails.
Notes
Copies files or whole directories.
Whensrcis a symlink, the link itself is copied rather than the target content.
normalmode refuses to overwrite existing targets; the other modes behave just like the convenience helpers.
Returnsnil, errwhen the path is invalid or conflicts occur.
Example
local ok, err = LCC.web_file.copy("/templates", "/backup/templates")
if not ok then
error(err)
end