writing to a text file is working good…But my problem is text file is created in different path….
Here is my code…
var _logFolderPath = Path.Combine(textboxPath.Text.Trim(), "log");
string[] subdirectoryEntries = Directory.GetDirectories(Path.Combine(txtBoxInput.Text, "RM"));
foreach (string subdirectory in subdirectoryEntries)
{
string[] x = Directory.GetFiles(subdirectory);
DirectoryInfo Folder = new DirectoryInfo(textboxPath.Text);
............
}
and
using (var dest = File.AppendText(Path.Combine(_logFolderPath,subdirectory+ ".txt")))
Here i have to store the subdirectory named text file in _logFolderPath path….But the text files are generared in the subdirectory path…I just need the name of the subdirectory to be created as a text file in _logFolderPath path…How to get the name of the subdirectory alone….Any suggestion?
Have a look at using DirectoryInfo and DirectoryInfo.Name Property