String is a valid directory

  • Thread starter Thread starter Al Reid
  • Start date Start date
A

Al Reid

What's the most efficient way to determine if an arbitrary string is a path to a valid, existing directory?

Also, how can I convert the string to the same case as the original directory, assuming that the existing directory is mixed case
and the string is lower case?

TIA,
 
Al Reid said:
What's the most efficient way to determine if an arbitrary string is a
path to a valid, existing directory?

'System.IO.Directory.Exists', 'System.IO.DirectoryInfo.Exists'.
 
Herfried K. Wagner said:
'System.IO.Directory.Exists', 'System.IO.DirectoryInfo.Exists'.

I guess I could do a quick timing test, but do you think that they are faster than the old

(GetAttr(strFilePath) And FileAttribute.Directory) = FileAttribute.Directory

I have potentially thousands of files and directories to handle in a short time frame and I want to use the fastest method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top