Reading all the files from a folder

  • Thread starter Thread starter sonu
  • Start date Start date
S

sonu

I want to collect all the information about files inside folder on
server.

I am using web application

Any help?
 
Hi sonu,
you can use the System.IO.DirectoryInfo class:

DirectoryInfo di = new DirectoryInfo(@"c:\somefolder");
FileInfo[] files = di.GetFiles();

you can then loop through all the files and do your processing.


If you are on a web server you may want to use HttpServerUtility.MapPath to
map virtual paths to actual locations on the hard disk.

Hope that helps
Mark R Dawson
http://www.markdawson.org





Hope that helps
 
Back
Top