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!

Recommended Answers

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 "

Jump to Post

All 2 Replies

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?

vb 2005 and vb 2008:

My.Computer.FileSystem.RenameFile("c:\test\test.txt", "c:\test\NewName.txt")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.