ÆÄÀÏÀ» º¹»çÇÕ´Ï´Ù.
FileCopy, SourcePattern, DestPattern [, Flag]
´ÜÀÏ ÆÄÀÏÀ̳ª Æú´õ ¶Ç´Â C:\Temp\*.tmp °°À¸ ¿ÍÀϵå Ä«µå ÆÐÅÏ. SourcePatternÀº ÀýÀç °æ·Î°¡ ÁöÁ¤µÇ¾î ÀÖÁö ¾ÊÀ¸¸é %A_WorkingDir%¿¡ ÀÖ´Ù°í °£Áֵ˴ϴÙ.
FileCopy, C:\*.txt, C:\My Folder
FileCopy, C:\*.txt, C:\My Folder\*.*
(¼±ÅÃÀû) ÀÌ Ç÷¡±×´Â ÆÄÀÏÀÌ ÀÌ¹Ì Á¸ÀçÇÏ¸é µ¤¾î¾µÁö ¸»Áö °áÁ¤ÇÕ´Ï´Ù:
0 = (±âº»°ª) ±âÁ¸ÀÇ ÆÄÀÏÀ» µ¤¾î¾²Áö ¾Ê½À´Ï´Ù
1 = ±âÁ¸ÀÇ ÆÄÀÏÀ» µ¤¾î ¾¹´Ï´Ù
ÀÌ ¸Å°³º¯¼ö´Â Ç¥Çö½ÄÀÏ ¼ö ÀÖ½À´Ï´Ù. ½ÉÁö¾î ÂüÀ̳ª °ÅÁþÀ¸·Î Æò°¡µÇ´Â °ÍÀÌ¸é ¹«¾ùÀÌµç °¡´ÉÇÕ´Ï´Ù (¿Ö³ÄÇÏ¸é ³»ºÎÀûÀ¸·Î ÂüÀº 1 °ÅÁþÀº 0À¸·Î ÀúÀåµÇ±â ¶§¹®ÀÔ´Ï´Ù).
[v1.1.04+] ÀÌ ¸í·É¾î´Â ¿¹¿Ü¸¦ ´øÁú ¼ö ÀÖ½À´Ï´Ù. ´õ ÀÚ¼¼ÇÑ Á¤º¸´Â ½ÇÇà½Ã°£ ¿¡·¯¸¦ ÂüÁ¶ÇϽʽÿÀ.
ErrorLevel´Â ¿¡·¯ ¶§¹®¿¡ º¹»ç¿¡ ½ÇÆÐÇÑ ÆÄÀÏÀÇ °³¼ö°¡ ¼³Á¤µË´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é 0ÀÌ ¼³Á¤µË´Ï´Ù.
¾î´À °æ¿ìµç, ¼Ò½º ÆÄÀÏÀÌ ´ÜÀÏ ÆÄÀÏÀÌ°í (¿ÍÀϵåÄ«µå ¾øÀ½) ±×¸®°í ±× ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾ÊÀ¸¸é, ErrorLevelÀº 0À¸·Î ¼³Á¤µË´Ï´Ù. ÀÌ »óȲÀ» ŽÁöÇÏ·Á¸é, º¹»çÇϱâ Àü¿¡ IfExist ¶Ç´Â FileExist()¸¦ ¼Ò½º ÆÄÀÏ¿¡ »ç¿ëÇϽʽÿÀ.
FileMove¿Í ´Ù¸£°Ô, ÆÄÀÏÀ» ÀÚ±â Àڽſ¡ º¹»çÇÏ´Â °ÍÀº ¾ðÁ¦³ª ¿¡·¯·Î °£Áֵ˴ϴÙ. µ¤¾î¾²±â ¸ðµå°¡ ÄÑÁ® À־ ¸¶Âù°¡ÁöÀÔ´Ï´Ù.
ÆÄÀÏÀÌ ¹ß°ßµÇ¸é, A_LastError´Â 0 (0) ¶Ç´Â ¸¶Áö¸· ½ÇÆÐ ÈÄ¿¡ °ð¹Ù·Î ¿î¿µ üÁ¦ÀÇ GetLastError() ÇÔ¼öÀÇ °á°ú°¡ ¼³Á¤µË´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é A_LastError¿¡´Â ¿Ö ÆÄÀÏÀÌ ¹ß°ßµÇÁö ¾Ê¾Ò´ÂÁö ¾Ë·ÁÁÖ´Â ¿¡·¯ Äڵ尡 ´ã±é´Ï´Ù.
FileCopy´Â ÆÄÀϸ¸ º¹»çÇÕ´Ï´Ù. ´ë½Å Æú´õÀÇ ³»¿ëÀ» (±×ÀÇ ¸ðµç ÆÄÀÏ°ú ÇÏÀ§ Æú´õ) º¹»çÇÏ·Á¸é, ¾Æ·¡ ¼½¼ÇÀÇ ¿¹Á¦¸¦ ÂüÁ¶ÇϽʽÿÀ. ´ÜÀÏ Æú´õ (ÇÏÀ§ Æú´õ Æ÷ÇÔ)¸¦ º¹»çÇÏ·Á¸é, FileCopyDirÀ» »ç¿ëÇϽʽÿÀ.
¿¡·¯¸¦ ¸¸³ªµµ ¿¬»êÀº ¸ØÃßÁö ¾Ê½À´Ï´Ù.
FileMove, FileCopyDir, FileMoveDir, FileDelete
FileCopy, C:\My Documents\List1.txt, D:\Main Backup\ ; »çº»À» ¸¸µéÁö¸¸ ¿øº»ÀÇ ÆÄÀÏ À̸§À» À¯ÁöÇÕ´Ï´Ù. FileCopy, C:\My File.txt, C:\My File New.txt ; ÆÄÀÏ¿¡ »õ À̸§À» ÁÖ°í, °°Àº Æú´õ ¾ÈÀ¸·Î º¹»çÇÕ´Ï´Ù. FileCopy, C:\Folder1\*.txt, D:\New Folder\*.bkp ; »õ À§Ä¡¿¡ º¹»çÇÏ°í »õ È®ÀåÀÚ¸¦ ºÎ¿©ÇÕ´Ï´Ù.
; ´ÙÀ½ ¿¹Á¦´Â ÇÑ Æú´õ ¾ÈÀÇ ¸ðµç ÆÄÀÏ°ú ÇÏÀ§ Æú´õ¸¦ ´Ù¸¥ Æú´õ·Î º¹»ç ÇÕ´Ï´Ù: ErrorCount := CopyFilesAndFolders("C:\My Folder\*.*", "D:\Folder to receive all files & folders") if ErrorCount <> 0 MsgBox %ErrorCount% files/folders could not be copied. CopyFilesAndFolders(SourcePattern, DestinationFolder, DoOverwrite = false) ; SourcePattern¿¡ ºÎÇÕÇÏ´Â ¸ðµç ÆÄÀÏ°ú Æú´õ¸¦ DestinationFolderÀ̶ó´Â À̸§ÀÇ Æú´õ¿¡ º¹»çÇÏ°í ; º¹»çÇÒ ¼ö ¾ø¾ú´ø ÆÄÀÏ/Æú´õÀÇ °³¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù. { ; ¸ÕÀú ¸ðµç ÆÄÀÏÀ» º¹»çÇÕ´Ï´Ù (Æú´õ´Â º¹»çÇÏÁö ¾Ê½À´Ï´Ù): FileCopy, %SourcePattern%, %DestinationFolder%, %DoOverwrite% ErrorCount := ErrorLevel ; ÀÌÁ¦ ¸ðµç Æú´õ¸¦ º¹»çÇÕ´Ï´Ù: Loop, %SourcePattern%, 2 ; 2ÀÇ ¶æÀº "Æú´õ¸¸ ¿¶÷ÇÑ´Ù"´Â ¶æÀÔ´Ï´Ù. { FileCopyDir, %A_LoopFileFullPath%, %DestinationFolder%\%A_LoopFileName%, %DoOverwrite% ErrorCount += ErrorLevel if ErrorLevel ; ¹®Á¦ÀÇ Æú´õ¸¦ À̸§À¸·Î º¸°íÇÕ´Ï´Ù. MsgBox Could not copy %A_LoopFileFullPath% into %DestinationFolder%. } return ErrorCount }