title: Powershell script to delete files not specified in a list
body: <p>I have a list of filenames in a text file like this:</p>
  
  <pre><code>f1.txt
  f2
  f3.jpg
  </code></pre>
  
  <p>How do I delete everything else from a folder except these files in Powershell?</p>
  
  <p>Pseudo-code:</p>
  
  <ul>
  <li>Read the text file line-by-line</li>
  <li>Create a list of filenames</li>
  <li>Recurse folder and its subfolders</li>
  <li>If filename is not in list, delete it.</li>
  </ul>