开发者

How to check whether a directory exists before inserting a file

I have a path like C:\application\photo\gallery\sketches.

Now I need to check whether 开发者_JAVA技巧this entire path exits or not before inserting a file into this location.


Directory.Exists Method is what you're looking for:

using System.IO;

//...

if(Directory.Exists(path)) 
{
    // your stuff here
}


Take a look at Directory.Exists.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜