FileSystem.FileCopy Method

Copies a file. The My.Computer.FileSystem Object gives you greater productivity and performance in file I/O operations than FileCopy. See My.Computer.FileSystem.CopyFile Method for more information.

Namespace: Microsoft.VisualBasic
Assembly: Microsoft.VisualBasic (in microsoft.visualbasic.dll)

public static void FileCopy (
	string Source,
	string Destination
)
public static void FileCopy (
	String Source, 
	String Destination
)
public static function FileCopy (
	Source : String, 
	Destination : String
)

Parameters

Source

Required. 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.

Destination

Required. String expression that specifies the target file name. Destination may include the directory or folder, and drive, of the destination file.

For more detailed information, see the Visual Basic topic FileCopy Function.

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.

This example uses the FileCopy function to copy one file to another. For purposes of this example, assume that SrcFile is a file containing some 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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: