title: Renaming a file in C# and excluding the extension of the file
body: <pre><code>FileInfo currentFile = new FileInfo("c:\\Blue_ 327 132.pdf"); 
  string fileNameFromDB = "c:\\Blue 327 _132.pdf"; 
  string newFileName = fileNameFromDB + currentFile.Extension; 
  currentFile.MoveTo(newFileName); 
  </code></pre>
  
  <p>I need rename it with new filenamefromDB </p>
  
  <pre><code>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\Orange_  325_  131.pdf
  </code></pre>
  
  <p>Since I'm using system.io.path but the files are present under C;\Uploads\..</p>
  
  <p>What if I have do looping for more than one files and directory path varies every time?</p>