"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[6048],{48:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>a});const i=JSON.parse('{"id":"XXTLanControl.lua/web-file/copy","title":"Copy Files Or Directories (LCC.web_file.copy)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/copy.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/copy","permalink":"/docs/en/XXTLanControl.lua/web-file/copy","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":250,"frontMatter":{"sidebar_position":250},"sidebar":"tutorialSidebar","previous":{"title":"Remove A Single Line (LCC.web_file.remove_line)","permalink":"/docs/en/XXTLanControl.lua/web-file/remove_line"},"next":{"title":"Copy And Overwrite (LCC.web_file.copy_overwrite)","permalink":"/docs/en/XXTLanControl.lua/web-file/copy_overwrite"}}');var o=r(4848),t=r(8453);const s={sidebar_position:250},l="Copy Files Or Directories (LCC.web_file.copy)",c={},a=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"copy-files-or-directories-lccweb_filecopy",children:"Copy Files Or Directories (LCC.web_file.copy)"})}),"\n",(0,o.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:"ok, err = LCC.web_file.copy(src, target, mode?, timeout?)\n"})}),"\n",(0,o.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["src",(0,o.jsx)(n.br,{}),"\n","String. Source path."]}),"\n",(0,o.jsxs)(n.li,{children:["target",(0,o.jsx)(n.br,{}),"\n","String. Destination path."]}),"\n",(0,o.jsxs)(n.li,{children:["mode",(0,o.jsx)(n.br,{}),"\n","String, optional. Copy mode, default ",(0,o.jsx)(n.code,{children:'"normal"'}),"; supports ",(0,o.jsx)(n.code,{children:'"overwrite"'}),", ",(0,o.jsx)(n.code,{children:'"merge"'}),", ",(0,o.jsx)(n.code,{children:'"overwrite-merge"'}),"."]}),"\n",(0,o.jsxs)(n.li,{children:["timeout",(0,o.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,o.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["ok",(0,o.jsx)(n.br,{}),"\n","Boolean. ",(0,o.jsx)(n.code,{children:"true"})," on success, ",(0,o.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,o.jsxs)(n.li,{children:["err",(0,o.jsx)(n.br,{}),"\n","String or ",(0,o.jsx)(n.code,{children:"nil"}),". Error description when the copy fails."]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,o.jsxs)(n.blockquote,{children:["\n",(0,o.jsxs)(n.p,{children:["Copies files or whole directories.",(0,o.jsx)(n.br,{}),"\n","When ",(0,o.jsx)(n.code,{children:"src"})," is a symlink, the link itself is copied rather than the target content.",(0,o.jsx)(n.br,{}),"\n",(0,o.jsx)(n.code,{children:"normal"})," mode refuses to overwrite existing targets; the other modes behave just like the convenience helpers.",(0,o.jsx)(n.br,{}),"\n","Returns ",(0,o.jsx)(n.code,{children:"nil, err"})," when the path is invalid or conflicts occur."]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'local ok, err = LCC.web_file.copy("/templates", "/backup/templates")\nif not ok then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var i=r(6540);const o={},t=i.createContext(o);function s(e){const n=i.useContext(t);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),i.createElement(t.Provider,{value:n},e.children)}}}]);