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

Description

Copies a file.

Syntax

fileInstance.CopyTo(string path, bool overWrite)

Arguments

ClassNameDescription
stringpathPath of a file.
booloverWriteValue that indicates whether overwriting is allowed.

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...", true); // The overwriting is allowed.

Notes

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

If the second argument is true, overwriting the existing file will be allowed.

If the second argument is false, overwriting the existing file will not be allowed.

Links for reference

Copyright © Rice All rights reserved.