I'm trying to tidy up a batch of filenames using Powershell and I'm getting this error:
Rename-Item : Cannot create a file when that file already exists. At line:1 char:7 + Dir | Rename-Item -NewName {$_.Name.Substring(0,$_.BaseName.Length-4) ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (C:\Users\garet\...e Mine (1).mp3:String) [Rename-Item], IOException + FullyQualifiedErrorId : RenameItemIOError,Microsoft.PowerShell.Commands.RenameItemCommand
The command I'm using is:
Dir | Rename-Item -NewName {$_.Name.Substring(0,$_.BaseName.Length-4) + $_.Extension}
-WhatIf
switch to the rename command to see what kind of file names you'll get. – vonPryz