IO operation taking long time for files in remote server
Posted
by
user841311
on Stack Overflow
See other posts from Stack Overflow
or by user841311
Published on 2012-11-27T10:51:10Z
Indexed on
2012/11/27
11:04 UTC
Read the original article
Hit count: 312
I have files of size 150 MB each in a remote server in a different domain in the network. I am accessing them thorugh UNC path. I want to read the file content and perform a basic string search. When I try reading the files line by line, the operation just don't finish and takes long time, more than 30 minutes.
However when I copy those files to my local machine, the same code reads and performs the string search in less than 5 seconds. I don't have .NET framework installed in the server so I have to do this from my machine. I want to perform all this through C# code in .NET framework 3.5 so I don't want to explictly ftp all the files to my machine before performing this operation.
Sample Code
DirectoryInfo dir = new DirectoryInfo(@strFilePath);
FileInfo[] fiArray = dir.getFiles("*.txt");
foreach (FileInfo fi in fiArray)
{
//reading file content from server takes long time but fast in local machine
//perform string search
}
Let me know if my requirement is not clear. Thanks in advance!
© Stack Overflow or respective owner