File Copy(String, String)
public static void FileCopy (string Source, string Destination);
String expression that specifies the name of the file to be copied.
Source may include the directory or folder, and drive, of the source file.
String expression that specifies the destination file name.
Destination may include the directory or folder, and drive, of the destination file.
Destination is invalid or not specified.
File is already open.
File does not exist.
This example uses the
FileCopy function to copy one file to another. For purposes of this example, assume that
SrcFile is a file that contains data.
Dim SourceFile, DestinationFile As String SourceFile = "SRCFILE" ' Define source file name. DestinationFile = "DESTFILE" ' Define target file name. FileCopy(SourceFile, DestinationFile) ' Copy source to target.
If you try to use the
FileCopy function on a currently open file, an error occurs.
FileCopy requires full trust to work on the local drive.
- See Also