Move Special Folders


New member
Dec 9, 2015
Programming Experience
I'm creating an application to move some folders from C drive (System Partition) to D drive (Another Partition) and create a symbolic link in source path to destination path. Below is my code that works with normal folders but not with special folders like Documents, Desktop, My Music etc. The code fails to move the special folders. How to move the special folders?

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim sFolder As String = "C:\Users\User\dwhelper"
        Dim dFolder As String = "D:\Test\User\dwhelper"
        Dim linkType As String = " /D "

        My.Computer.FileSystem.MoveDirectory(sFolder, dFolder, True)

        'Now we make the actual link, since there were no problems.
        Dim processSymlink As New Process()
        Dim startInfoSymlink As New ProcessStartInfo()
        startInfoSymlink.FileName = "cmd.exe"

        startInfoSymlink.Arguments = (("/C MKLINK" & linkType & """") + sFolder & """ """) + dFolder & """"
        'The /C means it finishes without waiting for user to do something.
        startInfoSymlink.CreateNoWindow = True

        'Gives the programmer control over output, even if we don't output it, no harm since user won't see it anyways.
        startInfoSymlink.UseShellExecute = False
        startInfoSymlink.RedirectStandardOutput = True

        'Sets up process and executes it.
        processSymlink.StartInfo = startInfoSymlink
        'My.Computer.FileSystem.CopyDirectory(sFolder, dFolder)'
    End Sub
Top Bottom