Hallo !
Ich habe folgendes Szenario:
* Festplatte nach bestimmten Dateien durchsuchen
* Liste der Einträge nach Doppelten "FILENAMEN" durchsuchen
* Diese dann in eine Datei schreiben
Hab mir ein bisschen was zusammen gesucht und bin jetzt erstmal so weit :
[autoit]dim $hFilesFolders[120]
dim $path[100][3]
dim $cab[100][3]
dim $iCol, $DESCENDING ,$ext,$iROWstart, $iROWend, $iCOLstart, $iCOLend, $DELIM,$sValue
$hFilesFolders = _FileListToArrayEx('h:', '*.zip')
For $i = 1 to $hFilesFolders[0]
_PathSplit($hFilesFolders[$i], $path[$i][0],$path[$i][1], $path[$i][2],$ext)
if $path[$i][2] = $path[$i-1][2] then
_FileWriteLog(@tempdir & '\log.txt',$path[$i][0] & $path[$i][1] & $path[$i][2] & '.nvs' & @CRLF & $path[$i-1][0] & $path[$i-1][1] & $path[$i-1][2])
EndIf
Next
Func _FileListToArrayEx($s_path, $s_mask, $i_flag = 0, $s_exclude = -1, $f_recurse = True, $f_full_path = True)
[/autoit][autoit][/autoit][autoit]If FileExists($s_path) = 0 Then Return SetError(1, 1, 0)
[/autoit][autoit][/autoit][autoit]; Strip trailing backslash, and add one after to make sure there's only one
$s_path = StringRegExpReplace($s_path, "[\\/]+\z", "") & "\"
; Set all defaults
If $s_mask = -1 Or $s_mask = Default Then $s_mask = "*.*"
If $i_flag = -1 Or $i_flag = Default Then $i_flag = 0
If $s_exclude = -1 Or $s_exclude = Default Then $s_exclude = ""
; Look for bad chars
If StringRegExp($s_mask, "[\\/:><\|]") Or StringRegExp($s_exclude, "[\\/:><\|]") Then
Return SetError(2, 2, 0)
EndIf
; Strip leading spaces between semi colon delimiter
$s_mask = StringRegExpReplace($s_mask, "\s*;\s*", ";")
If $s_exclude Then $s_exclude = StringRegExpReplace($s_exclude, "\s*;\s*", ";")
; Confirm mask has something in it
If StringStripWS($s_mask, = "" Then Return SetError(2, 2, 0)
If $i_flag < 0 Or $i_flag > 2 Then Return SetError(3, 3, 0)
; Validate and create path + mask params
Local $a_split = StringSplit($s_mask, ";"), $s_hold_split = ""
For $i = 1 To $a_split[0]
If StringStripWS($a_split[$i], = "" Then ContinueLoop
If StringRegExp($a_split[$i], "^\..*?\..*?\z") Then
$a_split[$i] &= "*" & $a_split[$i]
EndIf
$s_hold_split &= '"' & $s_path & $a_split[$i] & '" '
Next
$s_hold_split = StringTrimRight($s_hold_split, 1)
If $s_hold_split = "" Then $s_hold_split = '"' & $s_path & '*.*"'
Local $i_pid, $s_stdout, $s_hold_out, $s_dir_file_only = "", $s_recurse = "/s "
If $i_flag = 1 Then $s_dir_file_only = ":-d"
If $i_flag = 2 Then $s_dir_file_only = ":d"
If Not $f_recurse Then $s_recurse = ""
Local $i_buffer, $t_input, $t_output, $s_hold_binary
[/autoit][autoit][/autoit][autoit]$i_pid = Run(@ComSpec & " /u /c dir /b " & _
$s_recurse & "/a" & $s_dir_file_only & " " & _
$s_hold_split, "", @SW_HIDE, 4 + 2)
; Collect data from std i/o stream
While 1
$s_stdout = StdoutRead($i_pid, False, True)
If @error Then ExitLoop
$i_buffer = BinaryLen($s_stdout)
$t_input = DllStructCreate("byte[" & $i_buffer & "]")
$t_output = DllStructCreate("char[" & $i_buffer & "]")
DllStructSetData($t_input, 1, $s_stdout)
DllCall("kernel32.dll", "int", "WideCharToMultiByte", _
"int", 0, "int", 0, "ptr", DllStructGetPtr($t_input), _
"int", $i_buffer / 2, "ptr", DllStructGetPtr($t_output), _
"int", $i_buffer, "int", 0, "int", 0)
$s_hold_out &= StringRegExpReplace(DllStructGetData($t_output, 1), "(?i)(?:\A|\v)(?:(0+\v+)|(0+))|(\v*0+\z)", "")
$t_input = 0
$t_output = 0
WEnd
; Replace any extending verticle spaces from the end of the string
$s_hold_out = StringRegExpReplace($s_hold_out, "\v+\z", "")
If Not $s_hold_out Then Return SetError(5, 5, 0)
; Parse data and find matches based on flags
Local $a_fsplit = StringSplit(StringStripCR($s_hold_out), @LF), $s_hold_ret
$s_hold_out = ""
If $s_exclude Then $s_exclude = StringReplace(StringReplace($s_exclude, "*", ".*?"), ";", "|")
Local $i_path_len = BinaryLen($s_path)
For $i = 1 To $a_fsplit[0]
If $s_exclude And StringRegExp(StringRegExpReplace( _
$a_fsplit[$i], "(.*?[\\/]+)*(.*?\z)", "\2"), "(?i)" & $s_exclude) Then ContinueLoop
If StringRegExp($a_fsplit[$i], "^\w:[\\/]+") = 0 Then $a_fsplit[$i] = $s_path & $a_fsplit[$i]
If $f_full_path Then
$s_hold_ret &= $a_fsplit[$i] & Chr(1)
Else
$s_hold_ret &= StringTrimLeft($a_fsplit[$i], $i_path_len) & Chr(1)
EndIf
Next
$s_hold_ret = StringTrimRight($s_hold_ret, 1)
If $s_hold_ret = "" Then Return SetError(6, 6, 0)
Return StringSplit($s_hold_ret, Chr(1))
EndFunc
Vielleicht würde das sogar so in der Art funktionieren, wenn ich es vorher schaffen würde $path nach der Spalte $path[$i][2] von A-Z zu formatieren.
Würde mich über eine paar Kommentare freuen
so far baar