First time poster here so please be gentle.
I’m using Visual Studio Express 2010
I’m trying to create a backup program to backup specific folders and files each night to an external hard drive.
I’m using:
Dim dirs As List(Of String) = New List(Of String)(Directory.EnumerateDirectories(dirPath))
To get a list of directories on my local drive and then:
For Each folder In dirs
To cycle through all the directories and then:
If Not Directory.Exists(FdriveDirName) Then
My.Computer.FileSystem.CopyDirectory(CdriveDirName, FdriveDirName, True)
End if
This works fine for the first copy. My problem is when I create a new folder within a folder in the root directory (for example installing a new program would create a new folder in program files in c:) This new folder is NOT copied the 2nd time I run the program.
I can see the reason behind this is that the EnumerateDirectories function only lists folders one level down in the folder hierarchy.
I clearly need to list all folders AND subfolders but even replacing EnumerateDirectories with getdirectories hasn’t helped me.
Any one with any ideas?