Scripting Runtime Library(FileSystemObject)

ÁöÁ¤ÇÑ °æ·Î¿¡¼­ Æú´õ¿¡ ÇØ´çÇÏ´Â Folder °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
objectName
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó FileSystemObjectÀÇ À̸§ÀÌ´Ù.
folderPath
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ƯÁ¤ Æú´õÀÇ °æ·Î(Àý´ë °æ·Î ¶Ç´Â »ó´ë °æ·Î)¸¦ ³ªÅ¸³»´Â ¹®ÀÚ¿­ÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ª oFoler´Â folderPath·Î ÁöÁ¤µÈ À§Ä¡ÀÇ Æú´õ °³Ã¼ÀÌ´Ù.

¼³¸í

ÁöÁ¤ÇÑ °æ·Î¿¡¼­ Æú´õ¿¡ ÇØ´çÇÏ´Â Folder °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.

ÁöÁ¤ÇÑ Æú´õ°¡ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.


GetFolder ¸Þ¼­µå ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript C:\\JsTest GetFolder ¸Þ¼­µå ¿¹Á¦
JScript C:\\My Documents GetFolder ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=JScript>
function GetFolderTest(folderPath){
  var fso,folderObj,folderCol,str='';
  fso=new ActiveXObject('Scripting.FileSystemObject');
  folderObj=fso.GetFolder(folderPath);
  enumObj=new Enumerator(folderObj.SubFolders);
  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=GetFolderTest('C:\\JsTest')">
  <SPAN class=ie>JScript</SPAN> C:\\JsTest <SPAN class=method>GetFolder</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
<DIV class=show onClick="id=showjs.innerHTML=GetFolderTest('C:\\My Documents')">
  <SPAN class=ie>JScript</SPAN> C:\\My Documents <SPAN class=method>GetFolder</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScript C:\\JsTest GetFolder ¸Þ¼­µå ¿¹Á¦
VBScript C:\\My Documents GetFolder ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=VBScript>
Function GetFolderTestvb(folderPath)
  Dim fso,folderObj,folderCol
  str=""
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set folderObj=fso.GetFolder(folderPath)
  Set foldersCol=folderObj.SubFolders
  For Each folderObj in foldersCol
    str=str&folderObj.Path&"<BR>"
  Next
  GetFolderTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=GetFolderTestvb('C:\\JsTest')">
  <SPAN class=ie>VBScript</SPAN> C:\\JsTest <SPAN class=method>GetFolder</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
<DIV class=show onClick="showvb.innerHTML=GetFolderTestvb('C:\\My Documents')">
  <SPAN class=ie>VBScript</SPAN> C:\\My Documents <SPAN class=method>GetFolder</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>