Scripting Runtime Library(FileSystemObject)
ÁöÁ¤ÇÑ ÆÄÀÏÀÌ ÀÖÀ¸¸é true¸¦, ±×·¸Áö ¾ÊÀ¸¸é false¸¦ ¹ÝȯÇÑ´Ù.
¹Ýȯ°ª bValÀº ´ÙÀ½ Áß ÇϳªÀÇ ºÎ¿ï°ªÀÌ´Ù.
true | ÁöÁ¤ÇÑ ÆÄÀÏÀÌ ÀÖ´Ù. |
false | ÁöÁ¤ÇÑ ÆÄÀÏÀÌ ¾ø´Ù. |
<SCRIPT language=JScript> function FileExistTest(filePath){ var fso,str=filePath; fso=new ActiveXObject('Scripting.FileSystemObject'); if (fso.FileExists(filePath)) str+=' ÀÖ´Ù.'; else str+=' ¾ø´Ù.'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML=FileExistTest('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>JScript</SPAN> 'C:\\JsTest\\CreateText.txt' <SPAN class=method>FileExist</SPAN> ¸Þ¼µå ¿¹Á¦</DIV> <DIV class=show onClick="showjs.innerHTML=FileExistTest('C:\\JsTest\\testfile.txt')"> <SPAN class=ie>JScript</SPAN> 'C:\\JsTest\\testfile.txt' <SPAN class=method>FileExist</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function FileExistTestvb(filePath) Dim fso,str Set fso=CreateObject("Scripting.FileSystemObject") If (fso.FileExists(filePath)) Then str=filePath&" ÀÖ´Ù" Else str=filePath&" ¾ø´Ù." End If FileExistTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=FileExistTestvb('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>VBScript</SPAN> 'C:\\JsTest\\CreateText.txt' <SPAN class=method>FileExist</SPAN> ¸Þ¼µå ¿¹Á¦</DIV> <DIV class=show onClick="showvb.innerHTML=FileExistTestvb('C:\\JsTest\\testfile.txt')"> <SPAN class=ie>VBScript</SPAN> 'C:\\JsTest\\testfile.txt' <SPAN class=method>FileExist</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>