Monday, November 23, 2009

JavaScript list of Files in Folder

var folderspec="C:\\msa"
var fso, f, f1, fc, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(folderspec);
fc = new Enumerator(f.files);
s = "";
for (; !fc.atEnd(); fc.moveNext())
{
s += fc.item();
s += "
";

}
document.write(s);

1 comment:

Nagendra Prasad said...

I am getting "Un terminated string constant" error.
I am using IE 6 and have enabled all the Active X controls also.But still is not working