title: How to delete files based on condition in powershell
body: <p>I am trying to delete all the jpg files that do not have a txt file with the same file name.
  For example, files are named: 
  "output_1.jpg","output_1.txt", "output_2.jpg", "output_2.txt", "output_3.jpg", "output_4.jpg","output_4.txt", ... </p>
  
  <p>In this case, I want to delete output_3.jpg since it does not have a txt file with its name but I have no idea how to do it on powershell.</p>
  
  <p>So I'm guessing the pseudocode will be like this if I have 1000 sets of files:</p>
  
  <pre><code>for(i=0; i&lt;1000; i++){ if(output_%i.txt exists) delete output_%i.jpg;}
  </code></pre>
  
  <p>Thanks in advance.</p>