"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[4321],{8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>o});var t=r(6540);const l={},i=t.createContext(l);function s(e){const n=t.useContext(i);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:s(e.components),t.createElement(i.Provider,{value:n},e.children)}},9087:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"XXTLanControl.lua/web-file/delete","title":"Delete Files Or Directories (LCC.web_file.delete)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/delete.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/delete","permalink":"/docs/en/XXTLanControl.lua/web-file/delete","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":30,"frontMatter":{"sidebar_position":30},"sidebar":"tutorialSidebar","previous":{"title":"Create A Controller Directory (LCC.web_file.mkdir)","permalink":"/docs/en/XXTLanControl.lua/web-file/mkdir"},"next":{"title":"Check Path Existence (LCC.web_file.exists)","permalink":"/docs/en/XXTLanControl.lua/web-file/exists"}}');var l=r(4848),i=r(8453);const s={sidebar_position:30},o="Delete Files Or Directories (LCC.web_file.delete)",c={},d=[{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 a(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"delete-files-or-directories-lccweb_filedelete",children:"Delete Files Or Directories (LCC.web_file.delete)"})}),"\n",(0,l.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"ok, err = LCC.web_file.delete(path, force?, timeout?)\n"})}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["path",(0,l.jsx)(n.br,{}),"\n","String. File or directory path to remove."]}),"\n",(0,l.jsxs)(n.li,{children:["force",(0,l.jsx)(n.br,{}),"\n","Boolean, optional. Set to ",(0,l.jsx)(n.code,{children:"true"})," to delete non-empty directories; default ",(0,l.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,l.jsxs)(n.li,{children:["timeout",(0,l.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,l.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["ok",(0,l.jsx)(n.br,{}),"\n","Boolean. ",(0,l.jsx)(n.code,{children:"true"})," on success, ",(0,l.jsx)(n.code,{children:"false"})," on failure."]}),"\n",(0,l.jsxs)(n.li,{children:["err",(0,l.jsx)(n.br,{}),"\n","String or ",(0,l.jsx)(n.code,{children:"nil"}),". Error description; when the target is missing it's ",(0,l.jsx)(n.code,{children:"'not found'"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:["Deletes the specified file or directory.",(0,l.jsx)(n.br,{}),"\n","Deleting a non-empty directory without ",(0,l.jsx)(n.code,{children:"force"})," fails.",(0,l.jsx)(n.br,{}),"\n","Missing targets return ",(0,l.jsx)(n.code,{children:"false, 'not found'"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'local ok, err = LCC.web_file.delete("/reports/temp.txt")\nif not ok then\n    LCC.log(3, "Delete failed", err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(a,{...e})}):a(e)}}}]);