Method filesystem.createDirectoryFor
Overload
Creates parent directory for a new file, if does not exist. The same as filesystem.createDirectory, just removes filename from filePath.
public static bool createDirectoryFor(string filePath)
Parameters
filePath (string)
Path of new file. |
Returns
bool
|
Exceptions
ArgumentException
Not full path. No filename. |
AuException
Failed. |
Examples
string path = @"D:\Test\new\test.txt";
filesystem.createDirectoryFor(path);
File.WriteAllText(path, "text"); //would fail if directory @"D:\Test\new" does not exist