469,356 Members | 2,016 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

filesystemobject

jim
I have an example that iterates through the fso folders collection etc for
the fso files collection. The problem is this:
the example uses an enumerator to cycle through the collection items and i
would like to use a for loop but I can't get the syntax correct.
for (var i=1;i<=length;i++) {
eFile=oFldr.files;
alert(eFile.item(1).type);
}
TIA
Jul 23 '05 #1
1 1624
jim wrote on 18 jun 2004 in comp.lang.javascript:
I have an example that iterates through the fso folders collection etc
for the fso files collection. The problem is this:
the example uses an enumerator to cycle through the collection items
and i would like to use a for loop but I can't get the syntax correct.
for (var i=1;i<=length;i++) {
eFile=oFldr.files;
alert(eFile.item(1).type);
}


perhaps the .item(1). should be .item(i). ?
and the i<=length be i<=oFldr.length ?

==============================================

M$ enumerates:

function ShowFolderFileList(folderspec) {
var fso, f, fc, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(folderspec);
fc = new Enumerator(f.files);

for (; !fc.atEnd(); fc.moveNext()) {
alert(fc.item().name + "\n" + fc.item().type);
}

}

not tested.

see:
<http://msdn.microsoft.com/library/en-us/script56/html/jsprofiles.asp>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Marcelo Rizzo | last post: by
5 posts views Thread by John Dewbert | last post: by
2 posts views Thread by Sean S - Perth, WA | last post: by
2 posts views Thread by Luis Esteban Valencia | last post: by
1 post views Thread by G Gerard | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.