Scripting Runtime Library(FileSystemObject)
ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õ¸¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î º¹»çÇÑ´Ù.
¹Ýȯ°ªÀº ¾ø´Ù.
ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õ¸¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î º¹»çÇÑ´Ù.
FileÀ̳ª Folder¿¡ Copy ¸Þ¼µå¸¦ »ç¿ëÇϸé objectName¿¡ ÀÇÇØ ÂüÁ¶µÇ´Â ÆÄÀÏÀ̳ª Æú´õ¸¦ Àμö·Î Àü´ÞÇÏ´Â FileSystemObject.CopyFileÀ̳ª FileSystemObject.CopyFolder¸¦ »ç¿ëÇÑ °á°ú¿Í µ¿ÀÏÇÏ´Ù.
ÀÌ·± ´ëü ¸Þ¼µå¸¦ »ç¿ëÇϸé ÆÄÀÏÀ̳ª Æú´õ¸¦ Çѹø¿¡ ¿©·¯ °³ º¹»çÇÒ ¼ö ÀÖ´Ù.
<SCRIPT language=JScript> function CopyTest(filePath,destination){ var fso,fileObj,str=''; fso=new ActiveXObject('Scripting.FileSystemObject'); fileObj=fso.CreateTextFile(filePath,true); fileObj.WriteLine('Å×½ºÆ®ÀÌ´Ù.'); fileObj.Close(); fileObj=fso.GetFile(filePath); fileObj.Copy(destination); str+='»ý¼ºµÈ ÆÄÀÏ "'+filePath+'"°¡<BR>"'+destination+'"À¸·Î º¹»çµÇ¾ú´Ù.<BR><BR>'; folderObj=fso.GetFolder('c:\\JsTest\\test'); newPath='c:\\JsTest\\CopyTest'; if (!fso.FolderExists(newPath)) fso.CreateFolder(newPath); folderObj.Copy(newPath,true); str+='Æú´õ "'+folderObj+'"°¡ "'+newPath+'"À¸·Î º¹»çµÇ¾ú´Ù.'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML= CopyTest('C:\\JsTest\\test\\testfile.txt','C:\\JsTest\\test\\testcopy.txt')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>Copy</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function CopyTestvb(filePath,destination) Dim fso,fileObj,folderObj,newPath str="" Set fso=CreateObject("Scripting.FileSystemObject") Set fileObj=fso.CreateTextFile(filePath,True) fileObj.WriteLine("Å×½ºÆ®ÀÌ´Ù.") fileObj.Close Set fileObj=fso.GetFile(filePath) fileObj.Copy(destination) str=str&"»ý¼ºµÈ ÆÄÀÏ='"&filePath&"'°¡<BR>'"&destination&"'·Î º¹»çµÇ¾ú´Ù.<BR><BR>" Set folderObj=fso.GetFolder("c:\JsTest\test") newPath="c:\\JsTest\\CopyTest" If Not fso.FolderExists(newPath) Then fso.CreateFolder(newPath) End If folderObj.Copy(newPath) str=str&"Æú´õ '"&folderObj&"'°¡ '"&newPath&"'À¸·Î º¹»çµÇ¾ú´Ù." CopyTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML= CopyTestvb('C:\\JsTest\\test\\testfile.txt','C:\\JsTest\\test\\testcopy.txt')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Copy</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>