ContainerCmdletProvider.RenameItem
Method
Definition
Renames the item at the specified path to the new name provided.
protected virtual void RenameItem (string path, string newName);
Parameters
- path
- String
The path to the item to rename.
- newName
- String
The name to which the item should be renamed. This name should always be relative to the parent container.
Remarks
Providers override this method to give the user the ability to rename provider objects using the rename-item cmdlet.
Providers that declare <xref href="System.Management.Automation.Provider.ProviderCapabilities"></xref>
of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those
requirements by accessing the appropriate property from the base class.
By default overrides of this method should not allow renaming objects that are generally hidden from
the user unless the Force property is set to true. For instance, the FileSystem provider should
not allow renaming of a hidden or system file unless the Force property is set to true.
This method is intended for the modification of the item's name only and not for Move operations.
An error should be written to <xref href="System.Management.Automation.Provider.CmdletProvider.WriteError(System.Management.Automation.ErrorRecord)"></xref> if the <code data-dev-comment-type="paramref">newName</code>
parameter contains path separators or would cause the item to change its parent location.
The default implementation of this method throws an <xref href="System.Management.Automation.PSNotSupportedException"></xref>.