Jump to content

Help debugging with functions


BALA
 Share

Recommended Posts

I found this code while searching the Internet I thought I could probably create a GUI and modify it a bit to fit my needs.

;Recursive File Lister
 
Dim $FolderName = "C:\WINDOWS\SYSTEM32"
Dim $FileCount = 0
 
ScanFolder($FolderName)
 
MsgBox(0,"Done","Folder Scan Complete.  Scanned " & $FileCount & " Files")
 
Func ScanFolder($SourceFolder)
    Local $Search
    Local $File
    Local $FileAttributes
    Local $FullFilePath

    $Search = FileFindFirstFile($SourceFolder & "\*.*")
 
    While 1
        If $Search = -1 Then
            ExitLoop
        EndIf

        $File = FileFindNextFile($Search)
        If @error Then ExitLoop

        $FullFilePath = $SourceFolder & "\" & $File
        $FileAttributes = FileGetAttrib($FullFilePath)

        If StringInStr($FileAttributes,"D") Then
            ScanFolder($FullFilePath)
        Else
            LogFile($FullFilePath)
        EndIf
 
    WEnd
 
    FileClose($Search)
EndFunc
 
Func LogFile($FileName)
    FileWriteLine(@ScriptDir & "\FileList.txt",$FileName)
    $FileCount += 1
    ToolTip($FileName,0,0)
EndFuncoÝ÷ ØÚ0Ûzk-¢É"¦Ø^jëh×6ScanFolder($FolderName)

The answer is probably really simple, but i am a n00b so what do you expect. :P

(Man, I miss the GOTO command...)

P.S. I think it has something to do that I didn't include a command to read the input.

EDIT: Found error, sorry. :D

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
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...