954,153 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to change file name?

I'm learning vb.net, I have to work with file and folders.
I need to know how to change file or folder name.
Could you help me?
Thanks for advanced!

donaldunca
Light Poster
27 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

Sure no problem

Dim newName As New FileInfo("filename.gif")
   
   newName.MoveTo("filename2.gif")


This should work. You can look at fileinfo.moveto() or file.move() for more information

here is an example http://www.example-code.com/vbdotnet/rename-file.asp

you can google "vb.net rename file" and get more.

Does that help?

rapture
Posting Whiz in Training
294 posts since Jul 2007
Reputation Points: 155
Solved Threads: 41
 

vb 2005 and vb 2008:
My.Computer.FileSystem.RenameFile("c:\test\test.txt", "c:\test\NewName.txt")

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You