file class : CopyTo(string,bool) method
Description
Copies a file.
Syntax
fileInstance.CopyTo(string path, bool overWrite)
Arguments
Class | Name | Description |
string | path | Path of a file. |
bool | overWrite | Value that indicates whether overwriting is allowed. |
Return value
Class | Description |
file | An 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, it will overwrite the destination file even if it exists.
If the second argument is false, an exception will be raised if the destination file exists.