Hallo
Hab das hier geschrieben:
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 ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
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
__CopyEnum($file)
WEnd
FileClose($search)
EndSwitch
WEnd
Func __CopyEnum($sFile)
Local $iI=1, $aTmp
$aTmp = StringSplit($sFile, ".")
$sFileName = StringTrimRight($sFile, StringLen($aTmp[$aTmp[0]])+1)
$sFileExt = "." & $aTmp[$aTmp[0]]
If FileExists($sFile) Then
While FileExists($sFileName & "-" & $iI & $sFileExt)
$iI +=1
WEnd
For $iJ=$iI To 1 Step -1
FileMove($sFileName & "-" & $iJ & $sFileExt, $sFileName & "-" & $iJ+1 & $sFileExt)
Next
FileCopy($sFile , $sFileName & "-1" & $sFileExt)
EndIf
EndFunc ;==> __CopyEnum
Aber was passiert jetzt da?^^ Ich weis jetzt selber nicht was ich geschrieben hab, dachte CopyEnum macht irgendwie nen namen mit Zahlen Hintendran.