Mainly because of design I guess. I have a function that uses the folder
path way down the line someplace after a lot of other work has been done, so
i dont want to do lots of stuff and then find out the folder path i was
given cant be used now. To avoid this overhead i would like to check it up
front.

On Thu, Jun 17, 2010 at 2:07 PM, Michael Minutillo <
[email protected]> wrote:

> Hi Tom,
>
> Any extra context you can give us as to why you might want to do this? Is
> it something you could use http://transactionalfilemgr.codeplex.com/ for?
>
> Regards,
> Mike
>
>
> On Thu, Jun 17, 2010 at 11:59 AM, Tom Rutter <[email protected]> wrote:
>
>> Hi Ann, yes but I don't want to actually create it. i just want to check
>> if it *can* be created.
>>
>>
>> On Thu, Jun 17, 2010 at 1:56 PM, Anne Busby <[email protected]>wrote:
>>
>>>  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
>>>
>>
>>
>
>
> --
> Michael M. Minutillo
> Indiscriminate Information Sponge
> Blog: http://wolfbyte-net.blogspot.com
>

Reply via email to