Hallo zusammen
Ich kämpfe gerade mit folgendem Script:
#include <Array.au3>
$STARTPFAD="c:\MyFolder"
$SUCHORDNER="GesuchtesVerzeichniss"
$DATEN=_GETFILELIST($STARTPFAD,"n",1)
$RET=_ARRAYSEARCH($DATEN,$SUCHORDNER,1,0,0,TRUE )
If $ret > 0 Then MsgBox(0, '', $Daten[$ret]) ; gibt den kpl.Pfad zurück
If $ret <= 0 Then
MsgBox(4096, "Test", $ret)
Exit
EndIf
Func _GetFileList($T_DIR,$T_MASK,$DIR_ONLY=0)
Dim $N_DIRNAMES[200000] ; max number of directories that can be scanned
Local $N_DIRCOUNT = 0
Local $N_FILE
Local $N_SEARCH
Local $N_TFILE
Local $N_OFILE
Local $T_FILENAMES
Local $T_FILECOUNT
Local $T_DIRCOUNT = 1
Local $FILEMASK
; check Filemask \ for empty File-Array by GetDirOnly
If $FILEMASK = "n" Then $FILEMASK = "*.no"
; remove the end \ If specified
If StringRight($T_DIR,1) = "" Then $T_DIR = StringTrimRight($T_DIR,1)
$N_DIRNAMES[$T_DIRCOUNT] = $T_DIR
; Exit if base dir doesn't exists
If Not FileExists($T_DIR) Then Return 0
; keep on looping until all directories are scanned
While $T_DIRCOUNT > $N_DIRCOUNT
$N_DIRCOUNT = $N_DIRCOUNT + 1
; find all subdirs in this directory and save them in a array
$N_SEARCH = FileFindFirstFile($N_DIRNAMES[$N_DIRCOUNT] & "\*.*")
While 1
$N_FILE = FileFindNextFile($N_SEARCH)
If @error Then ExitLoop
; skip these references
If $N_FILE = "." Or $N_FILE = ".." Then ContinueLoop
$N_TFILE = $N_DIRNAMES[$N_DIRCOUNT] & "" & $N_FILE
; if Directory than add to the list of directories to be processed
If StringInStr(FileGetAttrib( $N_TFILE ),"D") > 0 Or _
StringInStr(FileGetAttrib( $N_TFILE ),"D,H,S") > 0 Then
$T_DIRCOUNT = $T_DIRCOUNT + 1
$N_DIRNAMES[$T_DIRCOUNT] = $N_TFILE
EndIf
Wend
FileClose($N_SEARCH) ; find all Files that mtach the MASK
$N_SEARCH = FileFindFirstFile($N_DIRNAMES[$N_DIRCOUNT] & "" & $T_MASK )
If $N_SEARCH = -1 Then ContinueLoop
While 1
$N_FILE = FileFindNextFile($N_SEARCH)
If @error Then ExitLoop
; skip these references
If $N_FILE = "." Or $N_FILE = ".." Then ContinueLoop
$N_TFILE = $N_DIRNAMES[$N_DIRCOUNT] & "" & $N_FILE
; if Directory than add to the list of directories to be processed
If StringInStr(FileGetAttrib( $N_TFILE ),"D") = 0 Or _
StringInStr(FileGetAttrib( $N_TFILE ),"D,H,S") = 0 Then
$T_FILENAMES = $T_FILENAMES & $N_TFILE & @CR
$T_FILECOUNT = $T_FILECOUNT + 1
;MsgBox(0,'filecount ' & $T_FILECOUNT ,$N_TFILE)
EndIf
Wend
FileClose($N_SEARCH)
Wend
If $DIR_ONLY = 0 Then
$T_FILENAMES = StringTrimRight($T_FILENAMES,1)
$N_OFILE = StringSplit($T_FILENAMES,@CR)
Return( $N_OFILE )
Else
ReDim $N_DIRNAMES[$N_DIRCOUNT+1]
$N_DIRNAMES[0] = $N_DIRCOUNT
Return $N_DIRNAMES
EndIf
EndFunc ;==>_GetFileList
Bei mir führt dieser zu "-1" auch wenn das Verzeichniss existiert
Irgendwie finde ich den Fehler nicht - ich hoffe ihr entdeckt den bei der durchsicht
Surfy