</head> <body> <h1>FileDelete</h1> <p>Deletes one or more files.</p> <pre class="Syntax"><span class="func">FileDelete</span>, FilePattern</pre> <h2 id="Parameters">Parâmetros</h2> <dl> <dt>FilePattern</dt> <dd><p>The name of a single file or a wildcard pattern such as <code>C:\Temp\*.tmp</code>. <em>FilePattern</em> is assumed to be in <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> if an absolute path isn't specified.</p> <p>To remove an entire folder, along with all its sub-folders and files, use <a href="FileRemoveDir.htm">FileRemoveDir</a>.</p></dd> </dl> <h2 id="Error_Handling">Error Handling</h2> <p><span class="ver">[v1.1.04+]</span>: This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p> <p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to the number of files that failed to be deleted (if any) or 0 otherwise. Deleting a wildcard pattern such as <code>*.tmp</code> is considered a success even if it does not match any files; thus ErrorLevel is set to 0.</p> <p>If files were found, <a href="../Variables.htm#LastError">A_LastError</a> is set to 0 (zero) or the result of the operating system's GetLastError() function immediately after the last failure. Otherwise A_LastError contains an error code that might indicate why no files were found.</p> <h2 id="Remarks">Remarks</h2> <p>To delete a read-only file, first remove the read-only attribute. Por exemplo: <code><a href="FileSetAttrib.htm">FileSetAttrib</a>, -R, C:\My File.txt</code>.</p> <h2 id="Related">Tópicos relacionados</h2> <p><a href="FileRecycle.htm">FileRecycle</a>, <a href="FileRemoveDir.htm">FileRemoveDir</a>, <a href="FileCopy.htm">FileCopy</a>, <a href="FileMove.htm">FileMove</a></p> <h2 id="Examples">Exemplos</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Deletes all .tmp files in a directory.</p> <pre>FileDelete, C:\temp files\*.tmp</pre> </div> </body> </html>