OE PowerTool 4.5.5
Twój adres IP to: 18.219.95.244
Przeglądarka: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
iconv.exe -t utf-8 "source.txt" > "target.txt"
Chodzi o to, że jeśli istnieje plik target.txt, to żeby był tworzony plik target(1).txt itd. A jeśli istnieje np. target(5).txt a nie istnieje
target(4).txt to żeby i tak był tworzony target(6).txt. Skrypt w PowerShellu, który to zadanie realizuje, może wyglądać tak:
$filename = "target.txt"
if(Test-Path "target.txt") {
$number = ls | foreach { if($_.Name -match "target\((\d+)\)\.txt") {$matches[1]} } | sort -InputObject {[decimal]$_} | select -last 1
$number++
$filename = "`"target`(" + $number + "`).txt`""
}
$command = "iconv.exe -t utf-8 source.txt > " + $filename
Invoke-Expression $command