Jump to content

Dir Search


Recommended Posts

Hya guys um i'm having trouble making a directory search function.I know all about the Filefind and those but i'm having a hard time creating a working function with it.

Ok heres what i'm trying to do. I want to have a function that will scan a folder and every subfolder looking for .exes. Easy enough but i can only get it up to the point where it finds the first folder. I dont think my codes going to cut it but i'll include it anyway.

$search = FileFindFirstFile("FOLDER TO SEARCH\*.*")   
    
    ; Check if the search was successful
     If $search = -1 Then
        Exit
     EndIf

     $core = (FOLDER STUB)
     While 1
        $file = FileFindNextFile($search) 
        If @error Then ExitLoop
        $righttext = StringRight ( $file, 4 ) 
    $swing = StringLeft ( $righttext, 1 )

    If ($file <> ".") Then
        If ($file <> "..") Then
            If ($file <> ".DS_Store") Then
                If ($file <> "Thumbs.db") Then
                     If ($swing == ".") Then
                         Msgbox(4096, "File:", $file)
                    ElseIf ($swing <> ".") Then

                        $newsearch = FileFindFirstFile(""& $core & $swing & "")
                         
                    ; Check if the search was successful
                            If $search = -1 Then
                             Exit
                            EndIf
                        
                        While 1

                    Else
                         MsgBox(4096, "Error", "Unable to determine the file type!")
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
     WEnd

Well i hope you guys see what i'm try to do and can help me out :-\

Link to comment
Share on other sites

  • Developers

Don't think your if's are making much sense here.

There is also a While 1 all by itself somewhere in the middle.

On My Autoit3 Stuff there is a http://www.autoitscript.com/fileman/users/jdeb/scriptlets/findfiles.au3 ... maybe that helps ..... :idiot:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...