title: C# listbox to file listing
body: <p>What I have is a listbox being populated by a textbox.</p>
  
  <p>I want to search in a specific directory for all files that match the listbox criteria.  I want do do this for each listing in the listbox, then I want to copy out all the matching files to another directory.</p>
  
  <p>So Listbox contains:
  Apple
  Orange
  Fruit</p>
  
  <p>i want to copy apple*.txt to destiondirectory, then copy orange*.txt to destination directory, and fruit*.txt to destinationdirectory.</p>
  
  <p>After everything has been copied i want to create a text file of each thing being copied to it's own text file.  So a directory listing from the destinationdirectory.</p>
  
  <p>So i would just get a text file of all the files that match a specific criteria IE apple*</p>
  
  <p>Thanks for the help and advice.</p>
  
  <pre><code>   string[] filesToCopy = listBox1.Items.
          string sourcefolder1 = @"K:\rkups";
          string destinationfolder = @"K:\g_aa_ge\qc";
          {
              string source = Path.Combine(sourcefolder1, filesToCopy[] + ".ann");
              string target = Path.Combine(destinationfolder, filesToCopy[] + ".ann");
              File.Copy(source,target);
  
   DirectoryInfo di = new DirectoryInfo(destinationfolder);
          FileInfo[] annfiles = di.GetFiles(string+"*.txt);
          foreach(FileInfo fi in annfiles)
  </code></pre>
  
  <p>the string+ is where i dont understand where/how to list each item in the listbox, and where 
    string[] filesToCopy = listBox1.Items. not sure how to list each item in the string</p>
  
  <p>updated:
  1) read each item in listbox<br>
  2) try to copy from a sourcedirectory to a destinationdirecory the item in listbox<br>
  3) repeat  </p>
  
  <p>thats it</p>