# =================================================================== # SCRIPT DE RENOMEAÇÃO FINAL E CORRIGIDO # Autor: Gemini (com base na análise do código do usuário) # =================================================================== # Lista de caracteres invisíveis 100% compatíveis com as fontes do Windows $invisibleChars = @( [char]0x3164, # Hangul Filler (O melhor e mais confiável) [char]0x00A0, # No-Break Space [char]0x200B, # Zero Width Space [char]0x200C, # Zero Width Non-Joiner [char]0x200D, # Zero Width Joiner [char]0xFEFF # Zero Width No-Break Space ) $baseCount = $invisibleChars.Count # Função que gera um nome invisível ÚNICO e GARANTIDO para cada arquivo function Get-UniqueInvisibleName($index) { if ($index -lt 0) { return "" } $name = "" $currentIndex = $index do { $remainder = $currentIndex % $baseCount $name = $invisibleChars[$remainder] + $name $currentIndex = [Math]::Floor($currentIndex / $baseCount) -1 } while ($currentIndex -ge 0) return $name } $desktopPaths = @( [Environment]::GetFolderPath("Desktop"), "$env:PUBLIC\Desktop" ) $logPath = "$env:USERPROFILE\Desktop\log_final_gemini.txt" "--- LOG DE RENOMEACAO FINAL $(Get-Date) ---`n" | Out-File -FilePath $logPath -Encoding UTF8 $allItems = Get-ChildItem -Path $desktopPaths -File -Force -ErrorAction SilentlyContinue $total = $allItems.Count $errors = 0 # Loop principal que renomeia cada item de forma sequencial for ($i = 0; $i -lt $total; $i++) { $item = $allItems[$i] try { # Gera o nome invisível com base na posição do arquivo na lista (garante unicidade) $newName = (Get-UniqueInvisibleName $i) + $item.Extension Rename-Item -LiteralPath $item.FullName -NewName $newName -ErrorAction Stop Add-Content -Path $logPath -Value "OK: '$($item.Name)' -> '$newName'" } catch { $errors++ Add-Content -Path $logPath -Value "ERRO: '$($item.Name)' -> $($_.Exception.Message)" } } "`nConcluído: $($total - $errors) renomeados com sucesso, $errors falharam." | Tee-Object -FilePath $logPath -Append Write-Host "`n✅ Processo finalizado com sucesso! Log salvo em: $logPath" -ForegroundColor Green