</head> <body> <h1>FileRemoveDir</h1> <p>Deletes a folder.</p> <pre class="Syntax"><span class="func">FileRemoveDir</span>, DirName <span class="optional">, Recurse</span></pre> <h2 id="Parameters">Parameters</h2> <dl> <dt>DirName</dt> <dd><p>Name of the directory to delete, which is assumed to be in <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> if an absolute path isn't specified.</p></dd> <dt>Recurse</dt> <dd> <p>This parameter determines whether to recurse into subdirectories. If omitted, it defaults to 0 (false). Specify one of the following values:</p> <p><strong>0</strong> (false): Do <strong>not</strong> remove files and sub-directories contained in <em>DirName</em>. In this case, if <em>DirName</em> is not empty, no action will be taken and ErrorLevel will be set to 1.</p> <p><strong>1</strong> (true): Remove all files and subdirectories (like the Windows command "rmdir /S").</p> <p>This parameter can be an <a href="../Variables.htm#Expressions">expression</a>, even one that evalutes to true or false (since true and false are stored internally as 1 and 0).</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 1 if there was a problem or 0 otherwise.</p> <h2 id="Related">Related</h2> <p><a href="FileCreateDir.htm">FileCreateDir</a>, <a href="FileDelete.htm">FileDelete</a></p> <h2 id="Examples">Examples</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Removes the directory, but only if it is empty.</p> <pre>FileRemoveDir, C:\Download Temp</pre> </div> <div class="ex" id="ExRecurse"> <p><a class="ex_number" href="#ExRecurse"></a> Removes the directory including its files and subdirectories.</p> <pre>FileRemoveDir, C:\Download Temp, 1</pre> </div> </body> </html>