/**
* Script: FileList.js
* Purpose: Used to retrieve and display all the files in a folder.
* Does not show child folders or their contents.
* Author: Daren Thiel
* Date: 21 November 1998
* Note: Rename this file FileList.js
* Web: http://www.winscripter.com
**/
/* Create the FileSystemObject */
fso = new ActiveXObject("Scripting.FileSystemObject");
/* Point the Object to a specific folder */
fsofolder = fso.GetFolder("C:\\temp");
/* get a collection of the files contained in that folder */
colFiles = fsofolder.Files;
/* Create an Enumerator so that we can move through the collection */
fc = new Enumerator( colFiles );
/* Create a variable to store an output message in */
var msg = "";
/* Loop through the Enumerator and add each item to our variable */
for (; !fc.atEnd(); fc.moveNext() ){
msg += fc.item() + "\n";
}
/* Show the user the results */
WScript.Echo( msg );