I've not tried it with Directories that end with a Space -- it will work
with "Storage Card" for instance. I'm going to give it a try though, b/c if
you end up with a Space at the end, it'd defintely make your program more
robust if you checked for a space if it will cause a problem. Definitely
something I want to check out.
Cheers,
Bill
"Andrew Boswell" <(E-Mail Removed)> wrote in message
news:Xns942E2E31D4andrewboswelldemonco@207.46.248.16...
> Hi Bill,
>
> Yes, all that is OK. My program works fine until I create a directory
> (using file explorer) that has a space at the end of its name, then
> GetFiles fails.
>
> I've now written a workaround using native calls to FindFirstFile and
> FindNextFile.
>
> Thanks for your help.
>
> Andrew
>
>
>
> "William Ryan" <(E-Mail Removed)> wrote in
> news:#(E-Mail Removed):
>
> > GetFiles does work, are you sure you are giving it a valid directory?
> >
> > For instance, try a Debug.Assert("SomeDirectory);
> > //now do the Directory.GetFiles("SomeDirectory"); //making sure the
> > some directory is the exact same thing.
> >
> > You may even want to use a string or constant like sooo
> >
> > string s = @"Storage Card\"
> >
> > Debug.Assert(s);
> > string[] myFiles = Directory.GetFiles(s);
> >
> > If you are using C#, make sure you use the @ and if not, make sure you
> > double escape the \\.
> >
> > HTH,
> >
> > Bill
> > "Andrew Boswell" <(E-Mail Removed)> wrote in message
> > news:Xns942DDDF099DACandrewboswelldemonco@207.46.248.16...
> >> Hi,
> >>
> >> On my Pocket PC, the call to Directory.GetFiles(folderPath) fails
> >> with "No such directory" exception if folderPath ends in a space,
> >> even though the folderPath is valid. It shows up OK in File Explorer.
> >>
> >> DirectoryInfo.GetFiles also fails in the same way.
> >>
> >> Any ideas for a workaround?
> >>
> >> Thanks,
> >> Andrew
> >
> >
> >
>
|