Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
  Tip: Dir$ returns a non-blank path for "CON" even if it doesn't exist  
 
 

Thanks to Joe Sova.

Do not use Dir to check for the existence of a folder, not one called \Con anyway. If you pass a string to Dir with \Con in it for the test, it will return it as true, even if the folder, "\Con" does not exist! I guess this goes back to a DOS problem from long ago where files could not be deleted if they had names of Dos devices.such as SCRN, CON and PRN.

Ex. ? dir$("C:\Con") = Con -Always!

This is a VB6 thing, not sure about .NET

Try using the following code to search for "C:\CON" and "C:\Temp\CON".

    MsgBox Dir$("C:\CON")
    MsgBox Dir$("C:\Temp\CON")

 

Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated