View Full Version : useing Server.Mappath

10-20-2003, 10:09 PM
I was wondering how do I use Server.MapPath to get all the subfolders in a folder for example

folder images inside that folder is flowers , people, places inside all of them are images but there are images in the images folder as well I need to see all the images for all the folders?

10-21-2003, 02:09 AM
You don't, this is job for the FileSystemObject (http://www.w3schools.com/asp/asp_ref_filesystem.asp).

You can use it to get all the files in all the folders.

10-21-2003, 03:26 AM

How is it possible that you haven't read this thread?:


It used to be sticky, but I'm going to re-stick it just for you (not sure why I unstuck it anyway!) :)

P.S. The relevant link in the above-mentioned thread is here:


I think that is a very good example, although you still need to go to w3schools.com and learn everything about FSO, if you plan on modifying it successfully. Not to mention the fact that it's a very good example of recursion in ASP (or the principle itself, regardless of the language). I think that's where I learned it. :)

10-21-2003, 04:39 AM

I think George went though and tried to reduce the number of stickies, see: http://www.codingforums.com/showthread.php?s=&threadid=26103

10-21-2003, 04:40 AM
That's cool, I dunno if he modified this forum, but I've only had 3 stickies at any one time, if I recall correctly (until now).

10-21-2003, 12:58 PM
I really dont know how I forgot about those pages but thats what happens when you post and run :) lol

Thanks again

10-22-2003, 06:28 AM
No problem, you should be able to modify brainjar's code to do what you want, it sounds like exactly what you're looking for.

I have some other stuff that I use at home and at work that is based off of the same idea, but I think his example is closer to what you're trying to do.

10-22-2003, 09:48 AM
yep I was sucessfully able to do what I needed :)


10-22-2003, 12:24 PM
My reply will probably seem irrelevant at this point but you should maybe check this thread in which the downside of FSO was mentionned... It doesn't concern your question directly since you want to get all the subfolders in a folder, but it might be interesting to read it anyways... ;)