Partilhar via


ContainerCmdletProvider.CopyItem(String, String, Boolean) Method

Definition

Copies an item at the specified path to an item at the copyPath.

protected:
 virtual void CopyItem(System::String ^ path, System::String ^ copyPath, bool recurse);
protected:
 virtual void CopyItem(Platform::String ^ path, Platform::String ^ copyPath, bool recurse);
 virtual void CopyItem(std::wstring const & path, std::wstring const & copyPath, bool recurse);
protected virtual void CopyItem (string path, string copyPath, bool recurse);
abstract member CopyItem : string * string * bool -> unit
override this.CopyItem : string * string * bool -> unit
Protected Overridable Sub CopyItem (path As String, copyPath As String, recurse As Boolean)

Parameters

path
String

The path of the item to copy.

copyPath
String

The path of the item to copy to.

recurse
Boolean

Tells the provider to recurse sub-containers when copying.

Remarks

Providers override this method to give the user the ability to copy provider objects using the copy-item cmdlet.

Providers that declare ProviderCapabilities of ExpandWildcards, Filter, Include, or Exclude should ensure that the path and items being copied meets those requirements by accessing the appropriate property from the base class.

By default overrides of this method should not copy objects over existing items unless the Force property is set to true. For instance, the FileSystem provider should not copy c:\temp\foo.txt over c:\bar.txt if c:\bar.txt already exists unless the Force parameter is true.

If copyPath exists and is a container then Force isn't required and path should be copied into the copyPath container as a child.

If recurse is true, the provider implementation is responsible for preventing infinite recursion when there are circular links and the like. An appropriate terminating exception should be thrown if this situation occurs.

The default implementation of this method throws an PSNotSupportedException.

Applies to