title: GetFile List and copy from Remote server to local
body: <p>Thanks all for the suggestion made for my earlier query regarding to the getlist and copy.
  I have only one issue here</p>
  
  <p>String realname= "test" //am getting this value from Db,so is this anyway i can use like that rather than </p>
  
  <p>string realname="<em>test</em>"//i know i can do like string realname="<em>"+Dbvalue+"</em>";</p>
  
  <p>Am just wondering why it doesn't return anyvalue if don't use "*" ?</p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              var getfiles = new fileshare.Program();
  
              string realname = "*test*";
              foreach (var file in getfiles.GetFileList(realname))
              {getfiles.copytolocal(file.FullName); }
  
              }
          private FileInfo[] GetFileList(string pattern)
          {
              var di = new DirectoryInfo(@"\\testserv01\dev");
              return di.GetFiles(pattern);
          }
          private void copytolocal(string filename)
          {
              string nameonly = Path.GetFileName(filename);
              File.Copy(filename,Path.Combine(@"c:\",nameonly));
  
          }
          }
  </code></pre>
  
  <p>Thanks in Advance.</p>