Scripting Runtime Library(FileSystemObject)

ÁöÁ¤ÇÑ Æú´õ¿¡ Æ÷ÇԵǾî ÀÖ´Â ¸ðµç File °³Ã¼·Î ±¸¼ºµÈ Files Ä÷º¼ÇÀ» ¹ÝȯÇÑ´Ù.

Àμö
object : (°³Ã¼)

object´Â Ç×»ó Folder °³Ã¼ÀÌ´Ù.

fileCol : (¼Ó¼º ÆÄÀÏ Ä÷º¼Ç)

ÁöÁ¤µÈ Folder °³Ã¼ÀÇ ¸ðµç File °³Ã¼·Î ±¸¼ºµÈ Files Ä÷º¼ÇÀÌ´Ù.

ÀÌ Ä÷º¼Ç¿¡´Â ¼û±è Ư¼º°ú ½Ã½ºÅÛ ÆÄÀÏ Æ¯¼ºÀÌ ¼³Á¤µÇ¾î ÀÖ´Â °³Ã¼µéÀ» Æ÷ÇÔÇÑ´Ù.

ÀÌ ¼Ó¼ºÀº ÀбâÀü¿ëÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.

¼³¸í

Enumerator °³Ã¼¿Í for ¹®Àåµî ·çÇÁ¹®ÀåÀ» »ç¿ëÇÏ¿© Files Ä÷º¼ÇÀÇ ±¸¼º¿øµéÀ» ¹Ýº¹ ½ÇÇà½Ãų ¼ö ÀÖ´Ù.



Files ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript Files ¼Ó¼º ¿¹Á¦
<SCRIPT language=JScript>
function FilesTest(folderPath){
  var fso,folderObj,enumObj,str='';
  fso=new ActiveXObject('Scripting.FileSystemObject');
  folderObj=fso.GetFolder(folderPath);
  enumObj=new Enumerator(folderObj.Files);
  for (; !enumObj.atEnd();enumObj.moveNext()){
    str+=enumObj.item()+'<BR>';
  }
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showjs.innerHTML=FilesTest('C:\\JsTest')">
  <SPAN class=ie>JScript</SPAN> <SPAN class=property>Files</SPAN> ¼Ó¼º ¿¹Á¦</DIV>

VBScript·Î ¹Ýº¹

°á°ú Ç¥½Ãâ
VBScript Files ¼Ó¼º ¿¹Á¦
<SCRIPT language=VBScript>
Function FilesTestvb(folderPath)
  Dim fso,folderObj,enumObj,fileObj
  str=""
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set folderObj=fso.GetFolder(folderPath)
  Set enumObj=folderObj.Files
  For Each fileObj in enumObj
    str=str&fileObj.Name&"<BR>"
  Next
  FilesTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=FilesTestvb('C:\\JsTest')">
<SPAN class=ie>VBScript</SPAN> <SPAN class=property>Files</SPAN> ¼Ó¼º ¿¹Á¦</DIV>