• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

String Manipulation How do I Change extension of file? IE: somefile.txt to somefile.mis

How do I change the extension of a file from

somefile.txt  to somefile.xml   or somefile.mis and such like ...

I know this is string manipulation here but I am very out of practice

  • 2
1 Solution
Dim myFile As String="C:\Folder\somefile.txt"

File.Move(myFile, myFile.Replace(".txt",".xml"))
As sirbounty has suggested the String.Replace method is the directy approach.

But you might also wanna take a look at the Path.ChangeExtension method.  It is designed to do precisely what you want.  Take a look at other members of the Path class, you might find them useful... they allow you easily to break up the full path into it's consitutient parts (drive letter, path, file name, extention, etc)

Happy to help - thanx for the grade! :^)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now