Ive created a little code to keep a 3 day archive of specified directories, I am not sure why the Users directory wont copy. Most likely a security problem, when running the code as administrator there are no exceptions and no files are copied. If not elevated it will throw "UnauthorizedAccessException" which is expected.
Code:
Module ModuleSync
Public Sub Main()
Dim SourceFolders As New List(Of String)()
With SourceFolders
.Add("C:\Users")
End With
Dim Drive As String = "E:"
If IO.Directory.Exists(Drive) Then
Dim DestinationRoot As String = Drive & "\SYNCED"
If Not IO.Directory.Exists(DestinationRoot) Then
IO.Directory.CreateDirectory(DestinationRoot)
End If
Dim DestinationRemove As String = DestinationRoot & "\" & Date.Today.AddDays(-3).ToString("yyyy-MM-dd")
DestinationRoot &= "\" & Date.Today.ToString("yyyy-MM-dd")
If Not IO.Directory.Exists(DestinationRoot) Then
IO.Directory.CreateDirectory(DestinationRoot)
End If
For Each Str As String In SourceFolders
My.Computer.FileSystem.CopyDirectory(Str, DestinationRoot, True) 'Nothing is copied
Next
If IO.Directory.Exists(DestinationRemove) Then
IO.Directory.Delete(DestinationRemove, True)
End If
End If
End Sub
End Module