count number of files in c#

hi all

i am trying to find a way to count the number of files in a particular folder.

i have done the same very easily in visual basic 6

but as i am creating a similar application in c# i am stuck up with this..

can anyone please help me with a code snippet or provide me some kind of assistance..

thank you.

it would be really greatful if someone helps me




Answer this question

count number of files in c#

  • Ajaykr

    thank u Mr.Leon..

    I will try this out and reply u.

    thank u



  • hellopower

    thank you Mr.Leon..

    It worked

    Thanks a lot



  • Thelostcircuit

    This is easier in .NET...

    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("c:\\");
    int count = dir.GetFiles().Length;


  • Angry Coder

    no problem... glad to help! ;-)

  • count number of files in c#