Scripting Runtime Library(FileSystemObject)
ÁöÁ¤ÇÑ °æ·Î¿¡¼ ƯÁ¤ ÆÄÀÏ¿¡ ÇØ´çÇÏ´Â File °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹Ýȯ°ª oFile´Â filePath·Î ÁöÁ¤µÈ À§Ä¡ÀÇ ÆÄÀÏ °³Ã¼¸¦ ÂüÁ¶ÇÑ´Ù.
ÁöÁ¤ÇÑ °æ·Î¿¡¼ ƯÁ¤ ÆÄÀÏ¿¡ ÇØ´çÇÏ´Â File °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
ÁöÁ¤ÇÑ ÆÄÀÏÀÌ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
<SCRIPT language=JScript> function GetFileTest(filePath){ var fso,fileObj,str; fso=new ActiveXObject('Scripting.FileSystemObject'); if (!fso.FileExists(filePath)){ fileObj=fso.OpenTextFile(filePath,2,true); fileObj.WriteLine('¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù.'); fileObj.Close(); } fileObj=fso.GetFile(filePath); str=fileObj.Path.toUpperCase()+'<BR>'; str+='¸¸µç ³¯Â¥: '+fileObj.DateCreated+'<BR>'; str+='¸¶Áö¸·À¸·Î ¾×¼¼½ºÇÑ ³¯Â¥: '+fileObj.DateLastAccessed+'<BR>'; str+='¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥: '+fileObj.DateLastModified return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showjs.innerHTML=GetFileTest('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>GetFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function GetFileTestvb(filePath) Dim fso,fileObj,str Set fso=CreateObject("Scripting.FileSystemObject") If Not fso.FileExists(filePath) Then Set fileObj=fso.OpenTextFile(filePath,2,True) fileObj.Write "¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù." fileObj.Close End If Set fileObj=fso.GetFile(filePath) str=fileObj.Path&"<BR>" str=str&"¸¸µç ³¯Â¥: "&fileObj.DateCreated&"<BR>" str=str&"¸¶Áö¸·À¸·Î ¾×¼¼½ºÇÑ ³¯Â¥: "&fileObj.DateLastAccessed&"<BR>" str=str&"¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥: "&fileObj.DateLastModified GetFileTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=GetFileTestvb('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>GetFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>