How to rename file in VB.NET

1 Answer

0 votes
Imports System.IO

Module Module1

    Sub Main()

        Dim s As String

        Try

            If File.Exists("d:\\data.bin") = True Then

                File.Move("d:\\data.bin", "d:\\data_new_name.bin")
                Console.WriteLine("rename success")

            End If

        Catch iex As IOException

            Console.WriteLine(iex.Message)

        End Try

    End Sub

    'run:
    ' 
    'rename success

End Module

 



answered Aug 26, 2015 by avibootz

Related questions

1 answer 278 views
278 views asked Aug 22, 2023 by avibootz
1 answer 360 views
360 views asked Jul 12, 2020 by avibootz
1 answer 329 views
329 views asked Mar 10, 2020 by avibootz
1 answer 356 views
1 answer 302 views
302 views asked Jun 9, 2018 by avibootz
1 answer 341 views
341 views asked Aug 26, 2015 by avibootz
2 answers 425 views
425 views asked Aug 26, 2015 by avibootz
...