v bataku to delat nebudu, ne ze by to neslo, ale bude bylo by to delsi - co treba PowerShell?
$oppath = Read-Host "Enter path of root folder (empty is current)"
echo > rename-file.bat
$initdata=Get-ChildItem -Path $oppath -Recurse -Include *.txt |Select-Object -property FullName
$icount=1
$savepath = ""
foreach($line in $initdata){
$extension = [System.IO.Path]::GetExtension($line.FullName)
$fullpath = [system.IO.Path]::GetFullPath($line.FullName)
$filename = [System.IO.Path]::GetFileName($line.FullName)
$filefolder = [system.io.Path]::GetDirectoryName($line.FullName)
if ($savepath -ne $filefolder) {
$icount=1
$savepath = [System.IO.Path]::GetDirectoryName($line.FullName)
}
$newfilename = $filename.Replace($extension,"")+$icount+$extension
Write-Host ren $fullpath $filefolder"\"$newfilename
$icount++
}
Neni to pekny, ale jako kostru to pouzit muzes. Predpolada, ze vystup budes ukladat do *.bat a ten potom spustis.