title: Windows 7 empty entire directory from command line
body: <p>I am running a batch file which deploys a war file to a specific directory. However, I want to empty that directory before deploying to it, recursively.</p>
  
  <p>I found this script that is supposed to remove everything in the directory including folders and files but I get this error: "%%i was unexpected at this time."</p>
  
  <pre><code>FOR /D %%i IN ("C:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0/abtapps/ROOT/*") DO RD /S /Q "%%i" DEL /Q "C:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0/abtapps/ROOT/*.*"
  </code></pre>
  
  <p>I just need a simple way to recursively empty my ROOT directory either by fixing the script above or with another method. Have to be able to do this from a batch file.</p>
  
  <p>I am running windows 7.</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <pre><code>rmdir ROOT /s /q
  mkdir ROOT
  </code></pre>