title: How to Delete All files But Excluding Specific Files (Batch File)
body: <p>I know there are questions here like this before but in my case there are special conditions in specifying the files to be excluded in the "delete" operation.</p>
  
  <p>Filename examples:</p>
  
  <p>A_001.xml<br>
  A_002.xml<br>
  B_001.xml<br>
  B_002.xml<br>
  B_003.xml<br>
  C_009.xml<br>
  D_002.xml  </p>
  
  <p>The files above are in one directory and I need to delete all files but retain one copy of each file with the highest counter in filename which are A_002.xm, B_003.xml, C_009.xml and D_002.xml.</p>
  
  <p>Is this possible? I'm new in batch file creation so please help me.. I already know how to delete files and even exclude a specific file extension but I don't know what to do in this scenario.</p>