how to change file name?

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Sep 2006
Posts: 27
Reputation: donaldunca is an unknown quantity at this point 
Solved Threads: 0
donaldunca's Avatar
donaldunca donaldunca is offline Offline
Light Poster

how to change file name?

 
0
  #1
Jan 7th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 276
Reputation: rapture has a spectacular aura about rapture has a spectacular aura about 
Solved Threads: 37
rapture rapture is offline Offline
Posting Whiz in Training

Re: how to change file name?

 
0
  #2
Jan 7th, 2009
Sure no problem

  1. Dim newName As New FileInfo("filename.gif")
  2.  
  3. 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?
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: how to change file name?

 
0
  #3
Jan 7th, 2009
vb 2005 and vb 2008:
My.Computer.FileSystem.RenameFile("c:\test\test.txt", "c:\test\NewName.txt")
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC