title: Fastest way to copy files from one directory to another
body: <p>I need to copy files from one directory to another, depending on the existence of the file name in a table of SQL database.</p>
  
  <p>For this I use the following code:</p>
  
  <pre><code>using(SqlConnection connection = new SqlConnection("datasource or route"))
  {
  
    connection.Open();
  
    using(SqlCommand cmd = new SqlCommand("SELECT idPic, namePicFile FROM DocPicFiles", connection))
    using (SqlDataReader reader = cmd.ExecuteReader())
    {
  
      if (reader != null)
      {
        while (reader.Read())
        {
          //picList IS AN ARRAY THAT Contains All the files names in a directory
          if (picList.Any(s =&gt; s.Contains(reader["namePicFile"].ToString())))
          {
            File.Copy("theFile  in the Directory or array picList",  "the destiny directory"+ ".jpg", false)
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>Is there any way that this can be done in less time? It takes 1 hour for do that, for 20.876 records.</p>