Creating links based on docs in a directory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok, I want to have a directory full of pdf files and a page that creates
links to them dynamically so that if I add 10 docs or subtract 7 or whatever,
they will be added or removed the next time the page is rendered. How do I
go about searching a directory and then creating links based on the filename
and location. Is this even possible?
 
string folderPath = MapPath(folderName);
string[] fileList = System.IO.Directory.GetFiles(folderPath);
for(int i=0;i <= fileList.GetUpperBound(0);i++)
{
Response.Write fileList.ToString();
}

go from there, you should be able to do what you need.
 
string folderPath = MapPath(folderName);
string[] fileList = System.IO.Directory.GetFiles(folderPath);
for(int i=0;i <= fileList.GetUpperBound(0);i++)
{
Response.Write fileList.ToString();
}

go from there, you should be able to do what you need.


Is there away of caching the link list and having the list regenerated
when the directory listing changes?

Sort of like a file dependency, but for a directory.
 
Back
Top