Scripting Runtime Library(FileSystemObject)

ÆÄÀÏ¿¡¼­´Â ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õÀÇ Å©±â¸¦ ¹ÙÀÌÆ® ´ÜÀ§·Î ¹ÝȯÇÑ´Ù.

Àμö
object

ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó object´Â File ¶Ç´Â Folder °³Ã¼ÀÌ´Ù.

: (¼Ó¼º Á¤¼ö°ª)
¼Ó¼º°ªÀº ÆÄÀÏ¿¡¼­´Â ÁöÁ¤ÇÑ ÆÄÀÏÀÇ Å©±â¸¦ ¹ÙÀÌÆ® ´ÜÀ§·Î ¹ÝȯÇÏ°í
Æú´õ¿¡¼­´Â ÁöÁ¤ÇÑ Æú´õ¿¡ µé¾îÀÖ´Â ¸ðµç ÆÄÀÏ°ú ÇÏÀ§ Æú´õÀÇ Å©±â¸¦ ¹ÙÀÌÆ® ´ÜÀ§·Î ¹ÝȯÇÑ´Ù.

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


Size ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript Size ¼Ó¼º ¿¹Á¦
<SCRIPT language=JScript>
function SizeTest(filePath){
  var fso, folderObj,str;
  fso=new ActiveXObject('Scripting.FileSystemObject');
  if (!fso.FileExists(filePath)){ // ¿À·ù ¹æÁö¸¦ À§ÇÏ¿© È­ÀÏÀÌ ¾øÀ¸¸é »ý¼ºÇÑ´Ù.
    fileObj=fso.OpenTextFile(filePath,2,true);
    fileObj.Write(filePath+' È­ÀÏ');
    fileObj.Close();
  }
  fileObj=fso.GetFile(filePath);
  folderObj=fileObj.ParentFolder
  str=fileObj.Path+'Àº(´Â) '+fileObj.size+'¹ÙÀÌÆ® »ç¿ëÇÑ´Ù.<BR>';
  str+=folderObj.Path+'Àº(´Â) '+folderObj.size+'¹ÙÀÌÆ® »ç¿ëÇÑ´Ù.<BR>';
  return(str);
}
</SCRIPT>

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

VBScript·Î ¹Ýº¹

°á°ú Ç¥½Ãâ
VBScript Size ¼Ó¼º ¿¹Á¦
<SCRIPT language=VBScript>
 function SizeTestvb(filePath)
  Dim fso,folderObj,str
  Set fso=CreateObject("Scripting.FileSystemObject")
  If Not fso.FileExists(filePath) Then ' ¿À·ù ¹æÁö¸¦ À§ÇÏ¿© ¿øº» È­ÀÏÀÌ ¾øÀ¸¸é »ý¼ºÇÑ´Ù.
    Set fileObj=fso.OpenTextFile(filePath,2,true)
    fileObj.Write filePath&" È­ÀÏ"
    fileObj.Close
  End If
  Set fileObj=fso.GetFile(filePath)
  Set folderObj=fileObj.ParentFolder
  str=fileObj.Path&"Àº(´Â) "&fileObj.size&"¹ÙÀÌÆ® »ç¿ëÇÑ´Ù.<BR>"
  str=str&folderObj.Path&"Àº(´Â) "&folderObj.size&"¹ÙÀÌÆ® »ç¿ëÇÑ´Ù.<BR>"
  SizeTestvb=str
End Function
</SCRIPT>

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