create a folder if not exists

by pietman 2. March 2010 17:21

 

string filename = @"c:\here\there\where\myname.txt";

    string dir = Path.GetDirectoryName(filename);
    if (!System.IO.Directory.Exists(dir))
        System.IO.Directory.CreateDirectory(dir);

 

Tags:

c#

Add c0mment




  Country flag
biuquote
  • Comment
  • Preview
Loading


About ...

pietman celliersPietman Celliers
Bitlink  Ltd
bitlinkit.com