Method Copy
Copy(Directory, String, String, IOContext)
Copies the file src
to Directory to
under the new
file name dest
.
If you want to copy the entire source directory to the destination one, you can do so like this:
Directory to; // the directory to copy to
foreach (string file in dir.ListAll()) {
dir.Copy(to, file, newFile, IOContext.DEFAULT); // newFile can be either file, or a new name
}
NOTE: this method does not check whether dest
exist and will
overwrite it if it does.
Declaration
public virtual void Copy(Directory to, string src, string dest, IOContext context)
Parameters
Type | Name | Description |
---|---|---|
Directory | to | |
System.String | src | |
System.String | dest | |
IOContext | context |