Hab es mal angepasst ![]()
Bleibt noch die Möglichkeit, wenn Punkte im Dateinamen verwendet wurden (z.B. test.txt.old) ![]()
Das habe ich dann hier mal mit berücksichtigt:
AutoIt
Opt('MustDeclareVars', 1)
#include <MsgBoxConstants.au3>
CreateStructure()
Func CreateStructure()
Local $sFileName = "", $iResult = 0, $target
Local Const $hSearch = FileFindFirstFile("*.*")
If $hSearch = -1 Then
MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.")
Return False
EndIf
While 1
$sFileName = FileFindNextFile($hSearch)
If @error Then ExitLoop
If ($sFileName <> @ScriptName) then
$target = @ScriptDir & '\' & StringLeft($sFileName, StringinStr($sFileName, '.', Default, -1) - 1) & '\'
If not FileExists($target) then DirCreate($target)
FileMove(@ScriptDir & '\' & $sFileName, $target & $sFileName)
EndIf
WEnd
FileClose($hSearch)
EndFunc
Alles anzeigen
Edit: Corrected the slashes into correct direction.