How do I create directory if doesn't exist to create file?
Posted
by RoboShop
on Stack Overflow
See other posts from Stack Overflow
or by RoboShop
Published on 2010-06-02T06:14:58Z
Indexed on
2010/06/02
6:23 UTC
Read the original article
Hit count: 251
i have a piece of code here that breaks if the directory doesn't exist
System.IO.File.WriteAllText(filePath, content);
is it possible to do in one line (or a few lines) to check the directory leading to the new file doesn't exist and if not, to create it before creating the new file.
i'm in .NET 3.5 here.
© Stack Overflow or respective owner