title: Delete files with specific extension except a particular file
body: <p>I have a folder which contains the following files:</p>
  
  <p><a href="https://i.stack.imgur.com/abP2z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/abP2z.png" alt="enter image description here"></a></p>
  
  <p>How can I delete all files with extension .rst (File1.rst, File2.rst, File3.rst, File4.rst, File5.rst) except the file "index.rst" from a batch file.</p>
  
  <p>I have tried this, but it's not working:</p>
  
  <pre><code>for /f "skip=1 delims=" %%i in ('D:\hfTools\Projects\Validation-Source\Docs\source /b "*.rst"') do @(if "%i" neq "index.rst" echo %i)
  </code></pre>
  
  <p>Any help would be welcome. Thank you.</p>