In this web programming tutorial we will learn that how we can Writing a Text Files Line Counter in asp.net using c#,
Bellow is the code, it's so simple that I'm lazy to explain, enjoy:
DirectoryInfo dInfo = new DirectoryInfo(args[0]);
FileInfo[] Files = dInfo.GetFiles("*.php");
int i = 0;
foreach (FileInfo fInfo in Files)
{
string[] temp = File.ReadAllLines(fInfo.FullName);
i += temp.Length;
}
Console.WriteLine("Total Lines: " + i);
Console.ReadLine();
Tags:
asp.net