Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Rename-Item

Rename-Item - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Rename-Item

Description
Change the name of an existing item

Usage


Options


Example(s)
Rename a file:

PS C:\>rename-item -path c:\docs\dump.csv -newname Report.xls

Rename all .TXT files as .LOG files in the current directory:

PS C:\>get-childitem -Path *.txt | rename-item -NewName {$_.name -replace".txt",".log"}

Because the -Newname parameter does not accept wildcards, the above works by piping the output of Get-ChildItem and then using a -replace expression to calculate all the new filenames.