title: Is there a way to delete a folder that contains only one specific file with batch?
body: <p>Need a way to delete a folder (rd/rmdir) if it contains only one specific file within. If there are any other files or subfolders, ignore it. Trying to do so with as little code as possible. Currently, I'm doing this...</p>
  <pre><code>If Exist &quot;C:\Folder\SubFolder\filename.txt&quot; Move /Y &quot;C:\Folder\SubFolder\filename.txt&quot; &quot;%TEMP%&quot;
  If Not Exist &quot;C:\Folder\SubFolder\*&quot; RD &quot;C:\Folder\SubFolder&quot; /Q /S
  </code></pre>
  <p>However, even though the folder contains no files, the folder is never deleted.</p>
  <p>Is this possible within a batch file? Thanx in advance.</p>