How To Move a Directory Using VB.NET

This article explains how to move a directory from one path to another path.
  • 4676

Move a directory in VB.NET

The Directory.Move method moves an existing directory to a new specified directory with full path. The Move method takes two parameters. The Move method deletes the original directory.
The following code snippet moves the source directory to the destination directory.

Imports System.IO

Module Module1

    Sub Main()

        Dim sourceDirName As String = "C:\Temp"

        Dim destDirName As String = "C:\NewTemp"


            Directory.Move(sourceDirName, destDirName)

        Catch exp As IOException


        End Try

    End Sub

End Module


After executing above code you will see that all the existing directory moved to a new given directory with full path.


More Articles

© 2020 DotNetHeaven. All rights reserved.