Directory.CreateDirectory Method (String) Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. The path parameter specifies a directory path, not a file path. If the directory already exists, this method does nothing.
Anne Busby | Senior Developer 3 Sarich Way, Technology Park, Bentley, WA 6102 Phone +61 8 6250 7900 | Fax +61 8 6250 7999 P Please consider the environment before you print this email ________________________________ From: [email protected] [[email protected]] On Behalf Of Tom Rutter [[email protected]] Sent: Thursday, 17 June 2010 11:51 AM To: ozDotNet Subject: How to validate directory path Gday .net gurus Can I please get some recommendations on how to check if a directory can be created given a path if it already doesnt exist? As an example something like this public static bool CanCreateDir(string path) { if (System.IO.Directory.Exists(path)) { return true; } //TODO - figure out if the directory can be created } Cheers, Tom
