1개 이상의 파일을 한 위치에서 다른 위치로 이동합니다.
구문
object.MoveFile ( source, destination )
인수:
FileSystemObject의 이름입니다.주석
와일드카드 문자는 소스 인수의 마지막 경로 구성요소에서만 사용할 수 있습니다. 잘못된 경로를 전달한 경우 소스 파일 또는 대상 디렉토리가 존재하지 않음 오류가 발생합니다.
다음 예에서는 MoveFile 메소드의 사용을 보여 줍니다.
예 1:
Function MoveSingleFile(source, destination)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile source, destination
End Function
' Usage
MoveSingleFile "C:\Path\To\Source\File.txt", "C:\Path\To\Destination\File.txt"
예 2:
주:
소스 경로에서 와일드카드를 사용한 경우 대상이 기존 디렉토리여야 합니다. 디렉토리가 존재하지 않을 경우 오류가 발생합니다.
Function MoveMultipleFiles(source, destination)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile source, destination
End Function
' Usage
MoveMultipleFiles "C:\Path\To\Source\*.txt", "C:\Path\To\Destination\" 'Here Destination Directory must exists