how to count no of time a file present in a folder in c#

Posted by Sahoo under C# on 1/13/2012 | Points: 10 | Views : 689 | Status : [Member] | Replies : 1
Hi,

how to count no of time a file present in a folder in c#


ex;

let folder name is 'DAS'

it has files let( A,,D,F,R,T,A,D,A,E,R,T,Y,A,W,A)

HOW to count how many times file A present. in folder DAS.




Responses

Posted by: Naraayanan on: 1/23/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Check this way....
   

string fname ="A,,D,F,R,T,A,D,A,E,R,T,Y,A,W,A";
string[] str = fname.Split(',');
foreach (string st in str)
{
if (st == "A")
{
cnt += 1;
}
else
{
}
}
MessageBox.Show(cnt.ToString());


Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response