Click to See Complete Forum and Search --> : createArray from folder content


DMouse
06-25-2003, 02:40 AM
Kiaora

I wonder if anyone can help me with an easy way to create an array from the content of a folder (images) . Im guessing that I have to use the file system object and the getFolder method. how then can I iterate through the names to create an array ?

Any help would be great
Denis
NZ

DMouse
06-26-2003, 02:51 AM
Dave

Thanks for your reply.

The link you included however could not be found.

I wonder If would consider the following script and tell me where Im going wrong. I can extract the folder name from the folder object but cant access the files collection. Is it my dot syntax perhaps ?

Cheers
Denis...........

<html>
<head>
<title>FSO test</title>
<script language="JavaScript" src="library.js">

</script>

<script language="JavaScript">
function displayFiles(folderPath){
//document.write (folderPath);
var fsObj
var theFolder
var filesCollection
var rsLength
var theFileName

fsObj = new ActiveXObject("scripting.fileSystemObject");
theFolder = fsObj.GetFolder(folderPath);
filesCollection = theFolder.files;
rsLength = filesCollection.length
//document.write(theFolder.name); //returns NZ
for(i=0;i<rsLength;i++);
{
theFileName=filesCollection.fileName
document.write(theFileName + "<br>")

}
}

</script>
</head>

<body onload="displayFiles('C:/inetpub/wwwroot/NZABA/images/pics/NZ')">


</body>
</html>

DMouse
06-29-2003, 12:53 AM
Sorry I might not have mentioned that Im working with serverside Javascript. Did you consider the scripting in the last message ?

Denis....