| |
|
|
| Tolles Fundstück of Andreas Miethe: Rekursive Search of Files separate Process by XProfan 12 PExec(.
Andreas Miethe (25.12.10)
CompileMarkSeparation'##############################
'Rekursive Suche nach Dateien
'Andreas Miethe 2010
'##############################
$H Windows.ph
$H Messages.ph
Proc GetFilesInDir
'Rekursive oder einfache Suche nach Dateien
Parameters Directory$,Maske$,Liste&,Rekursiv%,Text&,Gefunden&
Struct FILETIME = dwLowDateTime&,\
dwHighDateTime&
Struct WIN32_FIND_DATA = dwFileAttributes&,\
ftCreationTime.FILETIME!,\
ftLastAccessTime.FILETIME!,\
ftLastWriteTime.FILETIME!,\
nFileSizeHigh&,\
nFileSizeLow&,\
dwReserved0&,\
dwReserved1&,\
cFileName$(~MAX_PATH),\
cAlternateFileName$(14)
Proc Suche
Parameters Directory$,Maske$,Liste&,Rekursiv%,Text&,Gefunden&
Var WFD# = New(WIN32_FIND_DATA)
Var Find1$ = ""
Var hFind& = 0
If (Directory$ <> "") and (Right$(Directory$,1) <> "\\")
Directory$ = Directory$+"\\"
EndIf
Var Find$ = Directory$+Maske$
hFind& = ~FindFirstFile(Find$,WFD#)
If hFind& <> 0
Settext Text&,Directory$
Repeat
If (Trim$(WFD#.cFileName$) <> ".") and (Trim$(WFD#.cFileName$) <> "..") and ((WFD#.dwFileAttributes& & ~FILE_ATTRIBUTE_DIRECTORY) <> ~FILE_ATTRIBUTE_DIRECTORY)
If Trim$(WFD#.cFileName$) <> ""
AddString(Liste&,Directory$+Trim$(WFD#.cFileName$))
Settext Gefunden&,Str$(GetCount(Liste&))
EndIf
EndIf
Until ~FindNextFile(hFind&,WFD#) = 0
~FindClose(hFind&)
Else
EndIf
If Rekursiv% = 1
Find1$ = Directory$+"*.*"
hFind& = ~FindFirstFile(Find1$,WFD#)
Repeat
If (Trim$(WFD#.cFileName$) <> ".") and (Trim$(WFD#.cFileName$) <> "..") and ((WFD#.dwFileAttributes& & ~FILE_ATTRIBUTE_DIRECTORY) = ~FILE_ATTRIBUTE_DIRECTORY)
'#########################################
'Hier ruft sich die Procedur selbst auf !!
'#########################################
Suche(Directory$+Trim$(WFD#.cFileName$),Maske$,Liste&,1,Text&,Gefunden&)
EndIf
Until ~FindNextFile(hFind&,WFD#) = 0
~FindClose(hFind&)
Dispose WFD#
EndIf
EndProc
Var Ende& = 0
WhileNot ende&
Suche(Directory$,Maske$,Liste&,Rekursiv%,Text&,Gefunden&)
Ende& = 1
EndWhile
Settext Gefunden&,"Suche beendet :" + Str$(GetCount(Liste&)) + " Dateien gefunden die dem Suchkriterium entsprechen"
End
EndProc
Declare Ende&
Windowstyle 512+24
window %maxx,%maxy
CLS ~GetSysColor(~Color_BTNFACE)
WindowTitle "Rekursion"
SetDialogFont ~GetStockObject(~DEFAULT_GUI_FONT)
Var Text& = Create("TEXT",%hwnd,"",0,0,width(%hwnd),24)
Var Gefunden& = Create("TEXT",%hwnd,"",0,28,width(%hwnd),24)
Var Liste& = Create("Listbox",%hwnd,0,0,100,width(%hwnd),height(%hwnd)-100)
Var P& = 0
Var IsOpen& = 1
Var h1&=PExec("|GetFilesInDir","C:\\","*.prf",Liste&,1,text&,Gefunden&)',%Hwnd,Liste&,find$+p$+find1$,2)
WhileNot Ende&
Waitinput
If %key = 2
process("Kill", h1&,0)
Ende& = 1
EndIf
/../Function-References/XProfan/endwhile/'>EndWhile
End
|
|
|
| |
|
|
|
Jörg Sellmeyer | Tja - there must one well diverse Posts of Andreas with Sternen slip. super thing! |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 01/03/11 ▲ |
|
|
|
|
| Yes, therefore the it unfortunately not self "Quelltexte/ Codesnippets" here so kategorisiert can it not directly for these Postings stars give. |
|
|
| |
|
|