Help Required

  • Thread starter Thread starter Techeek
  • Start date Start date
T

Techeek

I have a requirement as follows

I need to navigate to a folder X which contains numerous folders a,b,c etc.
Each
of the folders a,b,c have files withing them. i need to count the files in
each
of these folders and store the count in the database. If anyone has an idea
regarding this could you please share the same with me
 
heres 1 Way of doing this...there is prob better ways.

but A good start



string[] aFolders = Directory.GetDirectories("D:\\");

int iFiles;

for (int x=0;x<aFolders.Length;x++)

{

iFiles = Directory.GetFiles(aFolders[x]).Length;

Console.WriteLine("Folder " + aFolders[x].ToString() + " File Count " +
iFiles.ToString());

}

hope that helps...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top