Yes, there is a bad character in one of the paths. Odd thing though, .NET
fails on it, but I can move, copy, etc through windows. I'm getting a list
of files from a copy of another hard drive. The file was created and saved
through Microsoft Word. How can Microsoft Word create a file name that .NET
cannot access through GetFiles().
When the GetFiles function encounters a file name with a bad character, the
function throws an exception, and the String Array being populated by the
GetFiles function is Nothing.
I just can't believe this is how Microsoft wrote this function. Why can it
not AT LEAST give me the files that do not have illegal characters in the
file name.
Thanks,
Michael
"Family Tree Mike" <Fa************@discussions.microsoft.comwrote in
message news:2B**********************************@microsof t.com...
>
"Michael Jackson" wrote:
>In my .NET 2.0 VS 2005 VB application, I'm using Directory.GetFiles(path)
to
get all the files in the directory. However, I'm getting an error
regarding
"Illegal character in Path", even though I can copy, etc the file using
the
Windows XP explorer.
I can trap the error, but then this traps the entire GetFiles() function,
not just the one bad file.
Is there a way to just trap for the one bad file and continue on?
Michael
It is very likely the path you are sending it is wrong and has the bad
character.
>>