Set-ExecutionPolicy -ExecutionPolicy Bypass Write-Host "Loading the list of tiles. Please wait" $counter = 0 $MyArray = Get-ChildItem -Path $PSScriptRoot -Filter "*.tile" -Recurse | Select-Object fullname Write-Host "Renaming is in process. It requires few minutes. Please wait" foreach ($file in $MyArray) { $counter += 1 Rename-item -Path $file.FullName -NewName $file.FullName.Substring(0, $file.FullName.Length-5) if ($counter % 1000 -eq 0) { Write-Host $counter files processed out of $MyArray.Count } } Write-Host $counter files renamed Read-Host "Press any key"