title: Change File Extension VB.NET
body: <p>Is There any Function For changing a file extension in .NET?
  Or i have to rename a file?
  thanks</p>
  
  <p>For Example I want to rename each file in a directory with ".resxx" extension to .resx. what is the problem with my code? </p>
  
  <p>Dim [option] As SearchOption = SearchOption.AllDirectories
          [option] = SearchOption.AllDirectories</p>
  
  <pre><code>    Dim fileNames As String() = Directory.GetFiles("C:\New Folder", "*.resxx", [option])
      For Each f In fileNames
          Dim t As New FileInfo(f.ToString)
          MsgBox(Mid(f, 1, f.Length - 4))
          t.MoveTo(Mid(f, 1, f.Length - 4) + ".resx")
      Next
  </code></pre>