FileSystem.FileCopy(String, String) 메서드

정의

파일을 복사합니다. FileSystem을 사용하면 FileCopy을 사용할 때보다 파일 I/O 작업의 생산성 및 성능이 향상됩니다. 자세한 내용은 CopyFile(String, String)를 참조하세요.

public:
 static void FileCopy(System::String ^ Source, System::String ^ Destination);
public static void FileCopy (string Source, string Destination);
static member FileCopy : string * string -> unit
Public Sub FileCopy (Source As String, Destination As String)

매개 변수

Source
String

필수 요소. 복사할 파일의 이름을 지정하는 문자열 식입니다. Source에는 소스 파일의 디렉터리나 폴더 및 드라이브가 포함될 수 있습니다.

Destination
String

필수 요소. 대상 파일 이름을 지정하는 문자열 식입니다. Destination에는 대상 파일의 디렉터리나 폴더 및 드라이브가 포함될 수 있습니다.

예외

Source 또는 Destination이 잘못되었거나 지정되지 않았습니다.

파일이 이미 열려 있습니다.

파일이 없습니다.

예제

이 예제에서는 함수를 FileCopy 사용하여 한 파일을 다른 파일에 복사합니다. 이 예제에서는 가 SrcFile 데이터가 포함된 파일이라고 가정합니다.

Dim SourceFile, DestinationFile As String
SourceFile = "SRCFILE"   ' Define source file name.
DestinationFile = "DESTFILE"   ' Define target file name.
FileCopy(SourceFile, DestinationFile)   ' Copy source to target.

설명

현재 열려 있는 파일에서 FileCopy 함수를 사용하려고 하면 오류가 발생합니다.

FileCopy 로컬 드라이브에서 작동하려면 완전 신뢰가 필요합니다.

적용 대상

추가 정보