Sign in to follow this  
Followers 0
Skrip

Indexing issue.

3 posts in this topic

Hey guys. I've been playing around with this, and I can't figure out how to make it exclude the windows directory. Like - make it so it does not index that entire directory. Can anybody help 'ere?

Func _Recursive($Sourcedir)
    $a = 0
    $f = 0
    $d = 0
    $FileFound = 0
    $grand = ""
    While 1
        $Fold = $Sourcedir
        $Stack = $Fold & ">"
        $FileList = $Fold & ">"
        $file_o = FileOpen($dric[1] & "\found.txt", 2)
;~      MsgBox(0, "", $dric[1] & "\found.txt")
        FileWrite($file_o, @CRLF & "~~> " & $path & @CRLF)
        While $Stack <> ""
            $root = StringLeft($Stack, StringInStr($Stack, ">") - 1) & "\"
            $Stack = StringTrimLeft($Stack, StringInStr($Stack, ">"))
            $h = FileFindFirstFile($root & "*.*")
            
            If $h > -1 Then
                $FileFound = FileFindNextFile($h)
                While Not @error And $FileFound <> ""
                    If $FileFound <> "." And $FileFound <> ".." And _
                            StringInStr(FileGetAttrib($root & $FileFound), "D") Then
                        $Stack = $Stack & $root & $FileFound & ">"

                        $FileList = $FileList & $root & $FileFound & "<"
                        $d = $d + 1
                        $a = $a + 1
                    Else
                        If $FileFound = "." Or $FileFound = ".." Then
                        Else
                            $f = $f + 1
                            $a = $a + 1
                            $FileList = $FileList & $root & $FileFound & "<"
                        EndIf
                    EndIf

                    $len = StringLen($FileList)
                    If $len > 10000 Then
                        $grand = $grand & $FileList
                        $FileList = ""
                    EndIf
                    If $debug = 1 Then
                        ToolTip("Building List: Files-" & $f & " Folders-" & $d & " Total-" & $a & " File-" & $FileFound, 0, 0, "Root-" & $root)
                    EndIf
                    FileWrite($file_o, $root & $FileFound & @CRLF)
                    $FileFound = FileFindNextFile($h)
                WEnd
                FileClose($h)
                
            EndIf
        WEnd
;~      MsgBox(0, "Complete", "Files-" & $f & " Folders-" & $d & " Total-" & $a)
        $file_o = FileOpen($dric & "z\found.txt", 1)
        FileWrite($file_o, @CRLF & "~~> " & $path & @CRLF)
        FileWrite($file_o, "Files - " & $f & @CRLF & "Folders - " & $d & @CRLF & " Total - " & $a)
        $grand = $grand & $FileList
        $FileList = $grand
        $cleanup = StringReplace($FileList, ">", "<")
        $outputsubdirs = StringSplit($cleanup, "<", 1)
        Return $outputsubdirs
        Exit
    WEnd
EndFunc  ;==>_Recursive

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey guys. I've been playing around with this, and I can't figure out how to make it exclude the windows directory. Like - make it so it does not index that entire directory. Can anybody help 'ere?

If $FileFound = StringMid(@WindowsDir, StringInStr(@WindowsDir, "\", 0, -1) + 1) Then ContinueLoop

:P

Edit: Put in @WindowsDir vice @SystemDir.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Didn't seem to work...It counted all the strings (files) as that. So it skipped them all. So I played around with it, and had it actually search for the word 'windows', and if it contains it, then skip it. But that did not work.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
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
Sign in to follow this  
Followers 0