ContainerCmdletProvider.CopyItem Method

Definition

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

protected virtual void CopyItem (string path, string copyPath, bool recurse);
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 <xref href="System.Management.Automation.Provider.ProviderCapabilities"></xref>
        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 <code data-dev-comment-type="paramref">copyPath</code> exists and is a container then Force isn't required and <code data-dev-comment-type="paramref">path</code>
        should be copied into the <code data-dev-comment-type="paramref">copyPath</code> container as a child.

        If <code data-dev-comment-type="paramref">recurse</code> 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 <xref href="System.Management.Automation.PSNotSupportedException"></xref>.