If I have a path C:\Test\Test1\a.txt
and Test1 doesn't exist, how can I ensure it is created before appending to a.txt?
How about:
Directory.CreateDirectory(Path.GetDirectoryName(filename));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With