| 4GuysFromRolla.com : ASP FAQS : System.IO Namespace Classes | |||
|
| |||
| Question: | How do I determine if a file or directory exists? | ||
|
| |||
| Answer: | Both the File and Directory classes contain an Exists() method that accepts as a single parameter the physical path to a file on the Web server's file system and returns a Boolean value indicating whether or not the file exists.An example of using the Exists() method is shown below:
(Note that in the C# source code the backslash must be escaped by the use of two successive backslashes. However, if the string literal is preceded by an at sign (
Realize that you can easily translate a virtual path, like | ||
|
FAQ posted by Scott Mitchell at 9/3/2003 12:30:02 AM to the System.IO Namespace Classes category. This FAQ has been viewed 59,557 times. | |||
Copyright 2013 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers