Scripting Runtime Library(FileSystemObject)
Çϳª ÀÌ»óÀÇ ÆÄÀÏÀ» ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î º¹»çÇÑ´Ù.
¿ÍÀϵåÄ«µå ¹®ÀÚ(*)´Â source ÀμöÀÇ ¸¶Áö¸· °æ·Î ±¸¼º ¿ä¼Ò¿¡¸¸ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
overwrite °ª¿¡ °ü°è¾øÀÌ destinationÀÌ Àбâ Àü¿ë Ư¼º ÁýÇÕÀ» °¡Áö¸é CopyFileÀº ¼öÇàÇÒ ¼ö ¾ø´Ù.
¹Ýȯ°ªÀº ¾ø´Ù.
Copy ¸Þ¼µå´Â ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õ¸¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î º¹»çÇÑ´Ù.
FileÀ̳ª Folder¿¡ Copy ¸Þ¼µå¸¦ »ç¿ëÇϸé objectName¿¡ ÀÇÇØ ÂüÁ¶µÇ´Â ÆÄÀÏÀ̳ª Æú´õ¸¦ Àμö·Î Àü´ÞÇÏ´Â FileSystemObject.CopyFileÀ̳ª FileSystemObject.CopyFolder¸¦ »ç¿ëÇÑ °á°ú¿Í µ¿ÀÏÇÏ´Ù.
ÀÌ·± ´ëü ¸Þ¼µå¸¦ »ç¿ëÇϸé ÆÄÀÏÀ̳ª Æú´õ¸¦ Çѹø¿¡ ¿©·¯ °³ º¹»çÇÒ ¼ö ÀÖ´Ù.
source¿¡ ¿ÍÀϵåÄ«µå ¹®ÀÚ¸¦ »ç¿ëÇϰųª destinationÀÌ °æ·Î ±¸ºÐ ±âÈ£(\)·Î ³¡³ª¸é destinationÀº ÀÏÄ¡ÇÏ´Â ÆÄÀÏÀ» º¹»çÇÒ ±âÁ¸ Æú´õ¸¦ ³ªÅ¸³½´Ù.
±×·¸Áö ¾ÊÀ¸¸é destinationÀº ¸¸µé·Á´Â ÆÄÀÏÀÇ À̸§À» ³ªÅ¸³½´Ù.
µÑ Áß ¾î´À °æ¿ì¶óµµ °³º° ÆÄÀÏÀ» º¹»çÇÒ ¶§ ¾Æ·¡ ¼¼ °¡Áö Áß Çϳª°¡ ÀϾ ¼ö ÀÖ´Ù.
¿ÍÀϵåÄ«µå ¹®ÀÚ¸¦ »ç¿ëÇÑ source¿Í ÀÏÄ¡ÇÏ´Â ÆÄÀÏÀÌ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
CopyFile ¸Þ¼µå´Â ù ¹ø° ¿À·ù°¡ ¹ß»ýÇÏ¸é ±× »óÅ·ΠÁßÁöÇÑ´Ù.
À̶§ ¿À·ù°¡ ¹ß»ýÇϱâ Àü¿¡ º¯°æµÈ »çÇ×Àº µÇµ¹¸± ¼ö ¾ø´Ù.
<SCRIPT language=JScript> function CopyFileTest(source,destination){ fso=new ActiveXObject('Scripting.FileSystemObject'); fso.CopyFile(source,destination,true); str='"'+source+'"°¡ "'+destination+'"À¸·Î º¹»çµÇ¾ú´Ù.'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML= CopyFileTest('C:\\JsTest\\test\\*.txt','C:\\JsTest\\CopyFiletest\\')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>CopyFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function CopyFileTestvb(source,destination) Dim fso,fileObj Set fso=CreateObject("Scripting.FileSystemObject") fso.CopyFile source,destination str="'"&source&"'°¡ '"&destination&"'À¸·Î º¹»çµÇ¾ú´Ù." CopyFileTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML= CopyFileTestvb('C:\\JsTest\\test\\*.txt','C:\\JsTest\\CopyTest\\')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>CopyFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
±×·¯³ª ´ÙÀ½°ú °°ÀÌ »ç¿ëÇÒ ¼ö´Â ¾ø´Ù.
<SCRIPT language=JScript> fso=new ActiveXObject("Scripting.FileSystemObject"); fso.CopyFile("c:\\mydocuments\\*\\R1???97.xls","c:\\tempfolder") </SCRIPT>
<SCRIPT language=VBScript> FileSystemObject.CopyFile "c:\mydocuments\*\R1???97.xls","c:\tempfolder" </SCRIPT>