Hallo !
Ich habe folgendes problem:
nachdem ich alle doppelten dateien erkannt habe versuche ich sie auszuwerten und weiter zu verarbeiten
Nur irgendwie bekomm ich immer die gleichen array Fehler ... arrays scheinen wohl nicht so mein Ding zu sein
==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
[autoit]dim $hFilesFolders[120]
dim $iCol, $ext , $Col
Dim $path[100][3]
dim $out[100]
; file mask to search for
$hFilesFolders = _FileListToArrayEx('h:', '*.zip')
for $i = 1 to $hFilesFolders[0]
_PathSplit($hFilesFolders[$i], $path[$i][0],$path[$i][1], $path[$i][2],$ext) ;Pfade aufsplitten
_ArrayInsert($out, $i,$path[$i][2]) ;$path[][2] spiegeln
Next
_ArraySort($path,0,0,0,2);sortieren
_arraysort($out,0,0,0,0);sortieren
_Array2DEmptyDel($path, $Col=1);leere Zeilen löschen
_Array2DEmptyDel($out, $Col=0);leere Zeilen löschen
for $i = 1 to $out[0]
for $x = 1 to $path[0][2]
if $out[$i] = $path[$x-1][2] Then;überprüfen ob Dateiname gleich ist
MsgBox(0,"title",$out[$i] & @CRLF & $path[$x-1][2]);gleiche Dateinamen anzeigen
EndIf
Next
Next
; datum der doppelten Dateien vergleichen
; ältere datei löschen
hier die suchfunktion die ich benutzte
Spoiler anzeigen
;==================================================================================================
; Function Name: _Array2DSortFree($ARRAY, $sCOL_ASC [, $NUM=False])
; Description:: Sortierung von 1D/2D-Arrays nach freier Wahl
; 1D Sortierung Auf- oder Absteigend
; 2D mehrstufige Sortierung, Reihenfolge und Sortier-
; richtung (je Spalte) frei wählbar
; auch einzelne Spalte sortierbar
; Parameter(s): $ARRAY Das zu sortierende Array
; $sCOL_ASC String mit Sortierangaben "Spalte|Richtung [, Spalte|Richtung]"
; zu sortierende Spalte (0-Index)|Richtung (0-Asc, 1-Desc)
; z.B. Spalte 2 aufsteigend und in 2 absteigend Spalte 1
; _Array2DSortFree($ar2Sort, '1|0,0|1')
; optional $NUM "False" sortiert alphabetisch (Standard), "True" sortiert numerisch
; Return Value(s): Erfolg 0
; Fehler 1 Set Error 1 $ARRAY ist kein Array
; 2 1D-Array, aber Spaltenangabe für 2D
; 3 SQL-Fehler
; 4 Angaben für Spalte|Sortierrichtung fehlerhaft
; Requirements: #include <SQLite.au3>
; #include <SQLite.dll.au3>
; #include <Array.au3>
; Note: Es ist dringend erforderlich, die SQLite-Includes am Beginn des aufrufenden
; Skriptes auszuführen. Anderenfalls schlägt die Initialisierung der SQLite.dll
; durch _SQLite_Startup() fehl.
; Version: 3.3.0.0
; Author(s): BugFix ([email='bugfix@autoit.de'][/email])
;==================================================================================================
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