I am having the following code which read all file names from local machine and write them in text file. I need to read File Names from Remote Server. Thanks in Advance.
StreamWriter objsw = new StreamWriter("C:\\log.txt",true);
public void ReadAllFiles()
{
try
{
string[] arr = Directory.GetFiles(@"C:\Test");
foreach (string name in arr)
{
Console.WriteLine(name);
objsw.WriteLine(name);
}
}
catch (Exception)
{
throw;
}
finally
{
objsw.Dispose();
}
}