English
Source / code snippets

Files Getfilesindir Rekursive Search

 
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
 
01/02/11  
 




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.
 
01/03/11  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.925 Views

Untitledvor 0 min.
AndreasS01/01/19
Mende-daniel201407/22/18
Jörg Sellmeyer05/12/18
Jens (3)03/24/17
More...

Themeninformationen

this Topic has 2 subscriber:

iF (2x)
Jörg Sellmeyer (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie