Scripting Runtime Library(FileSystemObject)

Scripting Runtime Library¿¡¼­ Folder ¾È¿¡ ÀÖ´Â ¸ðµç Folder °³Ã¼ÀÇ Àбâ Àü¿ë Ä÷º¼ÇÀÌ´Ù.

[colName]=fsoName.Folders
Àμö
colName : (Ä÷º¼Ç À̸§)
¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç ÁöÁ¤µÈ Folder ¾ÈÀÇ ¸ðµç ÇÏÀ§ Folder °³Ã¼µéÀÇ ÁýÇÕü¸¦ ÂüÁ¶ÇÑ´Ù.
fsoName : (°³Ã¼¸í)
FileSystemObject °³Ã¼ÀÇ À̸§ÀÌ´Ù.
Folders : (Æú´õ Ä÷º¼Ç)
ÇʼöÀû ¿ä¼ÒÀ̸ç FileSystemObject °³Ã¼ÀÇ fsoName.SubFolders ¼Ó¼º¸¦ »ç¿ëÇÏ¿© ¿¬°áµÈ ¸ðµç FolderµéÀÇ Ä÷º¼Ç Á¤º¸¸¦ °¡Á®¿Â´Ù.
¼³¸í

Àбâ Àü¿ë Ä÷º¼ÇÀÌ´Ù.

colName.Count·Î °¹¼ö¸¦ ¾Ë¼ö ÀÖ°í, colName.Item(keyVal)À¸·Î ÇØ´ç µå¶óÀ̺긦 ÂüÁ¶ÇÒ ¼ö ÀÖ´Ù.



Folders Ä÷º¼Ç »ç¿ëÇÏ¿© ÇϺΠÆú´õÀÇ ¼Ó¼º¿¡ ¾×¼¼½ºÇÏ´Â ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript 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>
°á°ú Ç¥½Ãâ
JScript Folders Ä÷º¼Ç ¿¹Á¦

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>

¿¹Á¦Count ¼Ó¼º IE4 -
¢¡ Folders Ä÷º¼Ç °³Ã¼ÀÇ Ç׸ñ ¼ö¸¦ ¹ÝȯÇÑ´Ù. Àбâ Àü¿ëÀÌ´Ù.
¹®¹ý: [iVal=].Count
¿¹Á¦Item ¼Ó¼º IE4 -
¢¡ Folders Ä÷º¼Ç¿¡¼­ ÁöÁ¤ÇÑ idValÀ» ±â¹ÝÀ¸·Î ÇÏ´Â Ç׸ñ( oVal)À» ¹ÝȯÇÑ´Ù. Àбâ/¾²±â°¡ °¡´ÉÇÏ´Ù.
¹®¹ý: .Item(idVal)=[oVal]

¿¹Á¦Add ¸Þ¼­µå(Folders) IE4 -
¢¡ Folders Ä÷º¼Ç °³Ã¼¿¡ Å°-Ç׸ñ ½ÖÀ» Ãß°¡ÇÑ´Ù.
¹®¹ý: .Add(keyVal,itemVal)