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