View Full Version : listing all files in a directory
how would i list all the files in a directoy?
whammy
10-27-2002, 11:19 PM
http://www.w3schools.com/asp/coll_files.asp
:)
ah ha! thanks. i was looking for it there but for some reason it was hidding from me.
webmarkart
10-28-2002, 04:56 AM
Here is a firle directory script in asp that I did a while ago...
all of the images need to go into a folder root directory named icons and the default file just needs to be in the folder you want to be able to browse...
here is an example of what if looks like...
www.through-the-eyes.com/examples
BrainJar
10-28-2002, 10:43 PM
Here's a recursive one:
http://www.brainjar.com/asp/dirlist/
whammy
10-28-2002, 11:28 PM
That is very sweet (and elegant)... as a matter of fact since all of the answers here are helpful, and the last two are such good examples, I'm going to make this sticky. :)
glenngv
10-29-2002, 07:38 AM
Originally posted by BrainJar
Here's a recursive one:
http://www.brainjar.com/asp/dirlist/
great code! :)
but just one comment, you convert bytes to kb by dividing the size by 1000 instead of dividing it by 1024 :)
Response.Write(Round(folder.Size / 1000) & " KB total."
Mhtml
10-30-2002, 10:44 AM
Lol...Picky aren't you.:)
Well, mine does.....now;)
Mhtml
10-30-2002, 10:53 AM
Oops, forgot the attachment...lol
Roy Sinclair
10-30-2002, 08:41 PM
Anyone ever bother to mention that IIS (and most other web servers too) has this capability built into it? Just turn on "Directory Browsing" for any directory that you want to be browseable in the properties for that directory under IIS.
Mhtml
10-30-2002, 09:33 PM
But by using fso you have the ability to easily filter results, change how they are displayed etc.
whammy
10-30-2002, 11:58 PM
Yeah, it also helps if you are don't have direct access to IIS (such as where I work - it might be days before that got "turned on", or it could be minutes... but that's another story!) or if you're remotely hosted and don't want to wait until Monday to get something working. :)
But good job mentioning it, Roy - I rarely have direct access to IIS where I work, since they keep the server room under lock and key most of the time, so only one person can mess things up at any one time. ;)
Mhtml
10-31-2002, 12:04 AM
That to.:)
BrainJar
11-09-2002, 07:20 PM
but just one comment, you convert bytes to kb by dividing the size by 1000 instead of dividing it by 1024
Doh! Must be that stupid metric system confusing me. Thanks for catching that.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.