title: Validate document names in a directory with string inside txt file
body: <p>I am working on a script that validates a filename based on an entry inside a text file, e.g.:</p>
  <p>Document_1223.txt, Document_6666.txt, Document_4551.txt, etc...</p>
  <p>The text file will contain entries like this (without the whitespace in between):</p>
  <p>1223</p>
  <p>3221</p>
  <p>4551</p>
  <p>What I want to do is say, if the document name contains one of the entries in the text file we move it to another directory, if not, we move it to an errored directory.</p>
  <p>This is probably something quite trivial but I cannot seem to get it to work how I want it to, I've tried many ways and this is my latest</p>
  <pre><code>$dwhDocumentsSource = Get-ChildItem &quot;C:\source\documents&quot; -Filter *.edi
  $clientCodes = Get-Content &quot;C:\clients\clientcodes.txt&quot;
  
  foreach ($dwhDocument in $dwhDocumentsSource){
      if ($dwhDocument.Basename -contains $clientCodes){
          write-output &quot;Yes its there&quot;
      }
      else{
          write-output &quot;No its not there&quot;
      }
  }
  </code></pre>
  <p>For now, I am just trying to validate that it actually works, once I can do that I can do the moving part myself.</p>
  <p>I am assuming it's not working because it's comparing against the whole content of the txt file and not going over each line. Although I thought Get-Content saves the results in individual strings..</p>
  <p><strong>Edit: I should mention it always returns No its not there.</strong></p>
  <p>Any help appreciated, thanks!</p>