I am trying to make a small backup program in VB 2008 that copies a directory. I have researched for a long time and have posted a previous question with no suitable answer.
The problem I am running into is if I try to copy a directory and a file is in use or I have access denied it halts the copying progress at the file with the error and doesn't copy anything after it. I have explained this to many people but a lot of them can't understand the question so I am going to write an example:
say c:\test contains the following files:
Say we do not have access permissions to b.txt
If i try to copy the directory using:
My.Computer.FileSystem.CopyDirectory("c:\test", "c:\backup", True)
I will get an access denied error on b.txt and the copying process halts. I basically need the program to do something like this:
if file error Then
Skip file and continue copying
Easier Said then done. Please, do not focus on fixing the error by correcting permissions. That is not the solution I am looking for. I basically, want to skip any errors and continue copying until the directory and sub directories are copied.
If anyone has any suggesions, I would greatly appreciate it.