Link to home
Start Free TrialLog in
Avatar of awolarczuk
awolarczukFlag for Australia

asked on

How do i rename a file using vb 2005

Hi all i am wanting to rename a file after it has been copied, i have already got the copied to copy it i just need to rename is now

Thanks in advance
Avatar of aherps
aherps
Flag of Australia image

  Dim fi As New FileInfo("myFile.doc")
   
   fi.MoveTo("myFile2.doc")
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Don't forget the eternal excpetions:

One would assume the file path was validated before performing a rename action.

Wayne
what about filename collisions, invalid characters, network path access?
always catch those dang exceptions !!
That may be the case, but please show some respect and acknowledge other Experts when you use their solutions.

https://www.experts-exchange.com/help.jsp#hi416

Wayne
Avatar of awolarczuk

ASKER

Hi Wayne this is my question am i didnt make any bad comments mate i thank everyone for there comments