Hello...
I think System.IO.Directory is your friend here, though it's annoying
as it can't take your "filename" as input.
string filename = "c:\\uo\\*.txt";
string[] fnc = filename.Split('\\');
string path = String.Join("\\", fnc.Take(fns.Length -
1).ToArray()) + "\\"
string[] files = System.IO.Directory.GetFiles(path, fnc
[fnc.Length - 1]);
Then a foreach loop on "files" should be enough.
On 25 août, 16:30, Programmer <[email protected]> wrote:
> string filename = "C:\\uo\\E.txt";
> long linecount = 0;
> using (StreamReader sr = new StreamReader(filename))
> {
> string line;
> while ((line = sr.ReadLine()) != null)
> {
> linecount++;
> }
> }
> MessageBox.Show(linecount.ToString());
>
> i want to give general path in string filename. like i would like to
> count all .txt file records .
>
> any ideas.
>
> eg: string filename = "C:\\uo\\*.txt" i need something like this