Scripting Runtime Library(FileSystemObject)
ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õ¸¦ »èÁ¦ÇÑ´Ù.
¹Ýȯ°ªÀº ¾ø´Ù.
ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õ°¡ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
FileÀ̳ª Folder¿¡¼ Delete ¸Þ¼µå¸¦ »ç¿ëÇϸé FileSystemObject.DeleteFileÀ̳ª FileSystemObject.DeleteFolder¸¦ »ç¿ëÇÏ´Â °Í°ú µ¿ÀÏÇÑ °á°ú¸¦ ¾òÀ» ¼ö ÀÖ´Ù.
Delete ¸Þ¼µå´Â ³»¿ëÀÌ ÀÖ´Â Æú´õ¿Í ³»¿ëÀÌ ¾ø´Â Æú´õ¸¦ ±¸ºÐÇÏÁö ¾Ê´Â´Ù.
ÁöÁ¤ÇÑ Æú´õ´Â ³»¿ëÀÌ ÀÖµç ¾øµç »èÁ¦µÈ´Ù. µû¶ó¼ ÁÖÀÇÇÏ¿©¾ß ÇÑ´Ù.
<SCRIPT language=JScript> function DeleteTest(filePath){ var fso,fileObj,str=''; fso=new ActiveXObject('Scripting.FileSystemObject'); if (fso.FileExists(filePath)) fso.DeleteFile(filePath); fileObj=fso.CreateTextFile(filePath,true); fileObj.WriteLine('Å×½ºÆ®ÀÌ´Ù.'); fileObj.Close(); str+='ÆÄÀÏ "'+filePath+'"°¡ »ý¼ºµÇ¾ú´Ù.<BR>'; fileObj=fso.GetFile(filePath); fileObj.Delete(); str+='ÆÄÀÏ "'+filePath+'"°¡ »èÁ¦µÇ¾ú´Ù.<BR><BR>'; tempPath='C:\\JsTest\\DeletFolder'; if (fso.FolderExists(tempPath)) fso.DeleteFolder(tempPath); fso.CreateFolder(tempPath); tempObj=fso.GetFolder(tempPath); str+='Æú´õ "'+tempPath+'"°¡ »ý¼ºµÇ¾ú´Ù.<BR>'; tempObj.Delete(); str+='Æú´õ "'+tempPath+'"°¡ »èÁ¦µÇ¾ú´Ù.'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML=DeleteTest('C:\\JsTest\\test\\testDelete.txt')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>Delete</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function DeleteTestvb(filePath) Dim fso,fileObj,tempPath,tempObj Set fso=CreateObject("Scripting.FileSystemObject") If fso.FileExists(filePath) Then fso.DeleteFile(filePath) End If Set fileObj=fso.CreateTextFile(filePath,True) fileObj.WriteLine "Å×½ºÆ®ÀÌ´Ù." fileObj.Close str="ÆÄÀÏ '"&filePath&"'°¡ »ý¼ºµÇ¾ú´Ù.<BR>" Set fileObj=fso.GetFile(filePath) fileObj.Delete str=str&"ÆÄÀÏ '"&filePath&"'°¡ »èÁ¦µÇ¾ú´Ù.<BR><BR>" tempPath="C:\\JsTest\DeletFolder" If fso.FolderExists(tempPath) Then fso.DeleteFolder(tempPath) End If fso.CreateFolder(tempPath) str=str&"Æú´õ '"&tempPath&"'°¡ »ý¼ºµÇ¾ú´Ù.<BR>" Set tempObj=fso.GetFolder(tempPath) tempObj.Delete str=str&"Æú´õ '"&tempPath&"'°¡ »èÁ¦µÇ¾ú´Ù.<BR>" DeleteTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=DeleteTestvb('C:\\JsTest\\test\\testDelete.txt')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Delete</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>