Scripting Runtime Library¿¡¼ Folder ¾È¿¡ ÀÖ´Â ¸ðµç Folder °³Ã¼ÀÇ Àбâ Àü¿ë Ä÷º¼ÇÀÌ´Ù.
[colName]=fsoName.Folders
Àбâ Àü¿ë Ä÷º¼ÇÀÌ´Ù.
colName.Count·Î °¹¼ö¸¦ ¾Ë¼ö ÀÖ°í, colName.Item(keyVal)À¸·Î ÇØ´ç µå¶óÀ̺긦 ÂüÁ¶ÇÒ ¼ö ÀÖ´Ù.
Folders Ä÷º¼Ç »ç¿ëÇÏ¿© ÇϺΠÆú´õÀÇ ¼Ó¼º¿¡ ¾×¼¼½ºÇÏ´Â ¿¹Á¦
Enumerator °³Ã¼¿Í for ¹®ÀåÀ» »ç¿ëÇÏ¿© Ä÷º¼ÇÀ» ¹Ýº¹ ½ÇÇàÇÏ´Â ¹æ¹ýÀ» º¸¿©ÁØ´Ù.
<SCRIPT language=JScript> function colFoldersTest(folderPath){ var fso,foldersCol,enumObj,str=''; fso=new ActiveXObject('Scripting.FileSystemObject'); foldersCol=fso.GetFolder(folderPath); str+=folderPath+' Æú´õÀÇ ³»¿ª<BR>'; enumObj=new Enumerator(foldersCol.SubFolders); str+='ÃÑ '+foldersCol.SubFolders.Count+' Folders :<BR>'; for (; !enumObj.atEnd();enumObj.moveNext()){ str+=enumObj.item()+'<BR>'; } return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showjs.innerHTML=colFoldersTest('C:\\JsTest')"> <SPAN class=ie>JScript</SPAN> <SPAN class=collection>Folders</SPAN> Ä÷º¼Ç ¿¹Á¦</DIV>
VBScript·Î Folders Ä÷º¼ÇÀ» °¡Á®¿Í¼ For Each...Next ¹®ÀåÀ» »ç¿ëÇÏ¿© µ¿ÀÏÇÑ ³»¿ëÀ» º¸¿©ÁØ´Ù.
<SCRIPT language=VBScript> Function colFoldersTestvb(folderPath) Dim fso,foldersCol,folderObj,enumObj,str Set fso=CreateObject("Scripting.FileSystemObject") Set foldersCol=fso.GetFolder(folderPath) str=folderPath&" Æú´õÀÇ ³»¿ª<BR>" Set enumObj=foldersCol.SubFolders str=str&"ÃÑ "&foldersCol.SubFolders.Count&" Folders :<BR>" For Each folderObj in enumObj str=str & folderObj.Path & "<BR>" Next colFoldersTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showvb.innerHTML=colFoldersTestvb('C:\\JsTest')"> <SPAN class=ie>JScript</SPAN> <SPAN class=collection>Folders</SPAN> Ä÷º¼Ç ¿¹Á¦</DIV>