Scripting Runtime Library(FileSystemObject)
ÁöÁ¤ÇÑ ÆÄÀÏÀ» »èÁ¦ÇÑ´Ù.
ÁöÁ¤ÇÑ ÆÄÀÏ°ú ÀÏÄ¡ÇÏ´Â ÆÄÀÏÀÌ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
DeleteFile ¸Þ¼µå´Â ù ¹ø° ¿À·ù°¡ ¹ß»ýÇÏ¸é ±× »óÅ·ΠÁßÁöÇÑ´Ù.
À̶§ ¿À·ù°¡ ¹ß»ýÇϱâ Àü¿¡ º¯°æµÈ »çÇ×Àº µÇµ¹¸± ¼ö ¾ø´Ù.
Delete ¸Þ¼µå·Îµµ »èÁ¦ ÇÒ ¼ö ÀÖ´Ù.
<SCRIPT language=JScript> function DeleteFileTest(filePath){ var fso,str=''; fso=new ActiveXObject('Scripting.FileSystemObject'); if (!fso.FileExists(filePath)){ fileObj=fso.CreateTextFile(filePath,true); fileObj.WriteLine('Å×½ºÆ®ÀÌ´Ù.'); fileObj.Close(); str+='»èÁ¦ ¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏ "'+filePath+'"°¡ »ý¼ºµÇ¾ú´Ù.<BR>'; } fso.DeleteFile(filePath); str+='»èÁ¦ ¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏ "'+filePath+'"°¡ »èÁ¦µÇ¾ú´Ù.<BR>'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML=DeleteFileTest('C:\\JsTest\\test\\testDelete.txt')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>DeleteFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function DeleteFileTestvb(filePath) Dim fso,fileObj,str Set fso=CreateObject("Scripting.FileSystemObject") If Not fso.FileExists(filePath) Then Set fileObj=fso.CreateTextFile(filePath,True) fileObj.WriteLine "Å×½ºÆ®ÀÌ´Ù." fileObj.Close str="»èÁ¦ ¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏ '"&filePath&"'°¡ »ý¼ºµÇ¾ú´Ù.<BR>" End If fso.DeleteFile(filePath) str=str&"»èÁ¦ ¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏ '"&filePath&"'°¡ »èÁ¦µÇ¾ú´Ù.<BR>" DeleteFileTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=DeleteFileTestvb('C:\\JsTest\\test\\testDelete.txt')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>DeleteFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>