How To Move a File Using VB.NET

In this article I describe how to move a file.
  • 5697

Move a File in VB.NET

The Move method moves an existing file to a new location with the same or a different file name. The Move method takes the full path of the move file. The Move method deletes the original file.
The following code snippet moves the source file to the destination file.

Imports System.Text

Imports System.IO

Module Module1

    Sub Main()

        Dim fileName As String = "C:\Temp\MaheshTXFITx.txt"

        Dim fi As New IO.FileInfo(fileName)

        Dim destinationFile As String = "C:\Temp\Data\MaheshTXMoved.txt"



        Catch iox As IOException


        End Try

    End Sub

End Module




More Articles

© 2020 DotNetHeaven. All rights reserved.