Home Notices Documents Classes Download Others Rice
Classes  >  file  >  CopyTo(string)
file class : CopyTo(string) method

Description

Copies a file.

Syntax

fileInstance.CopyTo(string path)

Arguments

ClassNameDescription
stringpathPath of a file.

Return value

ClassDescription
fileAn instance that represents a file.

Sample code

1:

file f = new file("c:\somewhere...");

2:

file newFile = f.CopyTo("c:\newpath...");

Notes

It's a wrapper of the System.IO.FileInfo.CopyTo(String) method.

Please note whether a new file already exists. If it exists, error will occur.

Links for reference

Copyright © Rice All rights reserved.