Reputation: 11000
i need to create a folder named log after giving the path in a textbox like D:\New Folder
without giving the hardcore path in the code like var _logFolderPath = @"D:\New Folder\log";
and after that i need to create two text files ba.txt and ra.txt in that log folder
This is my code
DirectoryInfo Folder = new DirectoryInfo(textboxPath.Text);
var _logFolderPath =textboxPath.Text;
if (Folder.Exists)
if (!Directory.Exists(_logFolderPath)) Directory.CreateDirectory(_logFolderPath);
and
using (var dest = File.CreateText(Path.Combine(_logFolderPath, line2 + ".txt")))
for reference comparing two text files
Upvotes: 1
Views: 384
Reputation: 273169
How about changing the 2nd line to:
var _logFolderPath = Path.Combine(textboxPath.Text.Trim(), "log");
Upvotes: 4