My QuickBackup program copies certain folders to an external drive
The following throws an error System.UnauthorizedAccessException: 'Access to the path 'C:\Users\myname\Documents\My Music' is denied.'
This is my code
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'Copy contents to Documents & Date folder
Label1.Visible = True
Label1.Text = "Copying, please wait"
Refresh()
Dim mydatetime = DateTime.Now.ToString("dd-MMM-yyyy HH-mm-ss")
'make name for folder
Dim subFolder = pathToBackup & "Docs\" & "Documents " & mydatetime
MkDir(subFolder)
Label1.Text = subFolder
My.Computer.FileSystem.CopyDirectory("C:\Users\myname\Documents\", subFolder, True)
MsgBox("All done")
Label1.Visible = False
End Sub
Can someone help a beginner ?
The following throws an error System.UnauthorizedAccessException: 'Access to the path 'C:\Users\myname\Documents\My Music' is denied.'
This is my code
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'Copy contents to Documents & Date folder
Label1.Visible = True
Label1.Text = "Copying, please wait"
Refresh()
Dim mydatetime = DateTime.Now.ToString("dd-MMM-yyyy HH-mm-ss")
'make name for folder
Dim subFolder = pathToBackup & "Docs\" & "Documents " & mydatetime
MkDir(subFolder)
Label1.Text = subFolder
My.Computer.FileSystem.CopyDirectory("C:\Users\myname\Documents\", subFolder, True)
MsgBox("All done")
Label1.Visible = False
End Sub
Can someone help a beginner ?