469,592 Members | 2,030 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Creating links based on docs in a directory

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?
Nov 19 '05 #1
2 1021
string folderPath = MapPath(folderName);
string[] fileList = System.IO.Directory.GetFiles(folderPath);
for(int i=0;i <= fileList.GetUpperBound(0);i++)
{
Response.Write fileList[i].ToString();
}

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

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Stephen Zachmann" <St*************@discussions.microsoft.com> wrote in
message news:9C**********************************@microsof t.com...
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?

Nov 19 '05 #2
>string folderPath = MapPath(folderName);
string[] fileList = System.IO.Directory.GetFiles(folderPath);
for(int i=0;i <= fileList.GetUpperBound(0);i++)
{
Response.Write fileList[i].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.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.