title: How to compare filenames with partial match from a table or list
body: <p>I'm currently trying to code a simple tool to poll some files which arrive on a server at a designated time of night to confirm they have arrived and document any missing files. They will sit in this folder for approx. 40 minutes, then be moved out automatically via script (I have no control over this).</p>
  
  <p><strong>My question is:</strong></p>
  
  <p>How can I compare filenames for a partial match against a table (I want to match unique identifiers (<code>NUMBER</code> and <code>NUMBER2</code> below) in filename with those on a predefined table that the user can update via a Windows form). Presumably I want to split up the strings so I have split <code>NUMBER</code> and <code>NUMBER2</code> so I can compare these and see if they are included in the filename (<em>both</em> numbers must be included in the filename for it to be a match, and the order is significant).</p>
  
  <p><strong>Filename format:</strong> </p>
  
  <blockquote>
  <pre><code>NCR_XR_D_NUMBER_NUMBER2
  </code></pre>
  </blockquote>
  
  <p>As order is significant, <code>NCR_XR_D_8003_9611</code> does not equal <code>NCR_XR_D_9611_8003</code>.</p>
  
  <p>This is what I have right now:</p>
  
  <pre><code>public static void CheckIfFilesExist()
      {
          // Put all file names in XR File directory into array.
  
          string[] array1 = Directory.GetFiles(@Properties.Settings.Default.XRFolderSavedLocation); 
          //this location is stored as a app setting, type: string, scope: User. This is tested working OK.
  
          // Print filenames into Console. (making sure the array is populating).
          Console.WriteLine("--- Files:---");
  
         foreach(string name in array1)
          {
              Console.WriteLine(name);
          } 
  
      }
  </code></pre>