Scripting Runtime Library(FileSystemObject)

Scripting Runtime Library¿¡¼­ Æú´õ ¾È¿¡ ÀÖ´Â ¸ðµç File °³Ã¼ÀÇ Ä÷º¼ÇÀÌ´Ù.

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

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

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



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

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

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>

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

Files Ä÷º¼Ç¿¡´Â ¸Þ¼­µå°¡ ¾ø´Ù.