CopyTo()

FileInfo::CopyTo(const String&) method

Copies the file represented by the current object to the specified location. If the destination file already exists, the copying fails.

FileInfoPtr System::IO::FileInfo::CopyTo(const String &destFileName)

Arguments

ParameterTypeDescription
destFileNameconst String&The destination file name

Return Value

A FileInfo object that represents the copy

FileInfo::CopyTo(const String&, bool) method

Copies the file represented by the current object to the specified location. A parameter specifies if existing destination file should be overwritten.

FileInfoPtr System::IO::FileInfo::CopyTo(const String &destFileName, bool overwrite)

Arguments

ParameterTypeDescription
destFileNameconst String&The destination file name
overwriteboolTrue if the existing destination file should be overwritten, false if copying should fail if the destination file already exists

Return Value

A FileInfo object that represents the copy

See Also