I'm trying to write a powershell script to rename several files. Their file names are originally long alphanumeric strings that I'm hoping to rename to something more generic and add number to the end. Something like file1, file2, file3, etc. I'm using the Get-ChildItem and Rename-Item cmdlets but can't figure out how to add the increasing number to the end of the file name. I don't know how many files will need to be renamed every time, it could be one or two or it could be thousands. Can anyone point me in the right direction?
$NameIncrease = 1
Get-ChildItem -Path C:\Folder *.dcm -Recurse |
% { rename-item -NewName ('File {0} - {1}' -f $NameIncrease++) }