[thelist] Counting files in a folder using JavaScript (fwd)

Daniel J. Cody djc at members.evolt.org
Wed Dec 12 20:28:55 CST 2001


---------- Forwarded message ----------
Date: Wed, 12 Dec 2001 22:40:06 -0500 (EST)
From: sam <samiam at sam-i-am.com>
To: thelist at evolt.org
Subject: Re:[thelist] Counting files in a folder using JavaScript

one thing you *can* do is read a (server generated) directory index.
Assuming your script and your directory are both on the web server, and
under the same domain, you can turn directory browsing on for the
directry you want to count in, and load the directory index into a
hidden frame (e.g frame src = "yourdirectory/") then you can count
through the links array for that document (filtering out . and ../ etc)

I've used this technique a few times for creating no-maintenance
slideshows - you just drop the images in the directory and the
slideshow script is driven off the directory index, grabbing urls
and presenting them as a click-thru.
But you have to be able to turn on directory browsing on a per-directory
basis.

Sam





More information about the thelist mailing list