Kann ich nicht bestätigen ..., wird korrekt umbenannt in dummy_1 bis dummy_5.
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate ("Rename", 153, 231, 652, 344)
GUISetBkColor (0x808080)
$Input1 = GUICtrlCreateInput ("", 16, 40, 121, 21)
$Input2 = GUICtrlCreateInput ("", 48, 96, 65, 21)
$Label1 = GUICtrlCreateLabel ("Endung ", 56, 72, 44, 17)
$Label2 = GUICtrlCreateLabel ("Pfad zum Ordner ", 40, 8, 86, 17)
$Button1 = GUICtrlCreateButton ("Umbennen", 40, 192, 75, 25, 0)
$Input3 = GUICtrlCreateInput ("", 16, 160, 121, 21)
$Label3 = GUICtrlCreateLabel ("Neuer Name", 48, 128, 64, 17)
GUISetState (@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $n=1
[/autoit] [autoit][/autoit] [autoit]While 1
Switch GUIGetMsg ()
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$pfad = GUICtrlRead ( $Input1 )
$endung = GUICtrlRead ( $Input2 )
$name = GUICtrlRead ( $Input3 )
$search = FileFindFirstFile ($pfad&"\*."&$endung)
If $search = -1 Then
MsgBox (0, "Error", "Keine Datei mit der Endung "&$endung&" in "&$pfad&" gefunden")
Exit
EndIf
While 1
$file = FileFindNextFile ($search)
If @error Then ExitLoop
_Umbenennen ($file)
$n += 1
WEnd
$n = 1
EndSwitch
WEnd
Func _Umbenennen ($sFile)
Return FileMove ($pfad&"\"&$sFile, $pfad&"\"&$name&"_"&$n&"."&$endung, 0)
EndFunc
LG
Greenhorn