Jump to content

...


stuka
 Share

Recommended Posts

I had this laying around for finding files. I just modded it real quick, so it's not pretty (no error checking, function options etc), so it'll find extensions. Just run it and put in the extension you want to find (ex: jpg with no '.').

#include <array.au3>  ; just for _ArrayDisplay

$input = InputBox('What to Search for...', 'Find what ext? (ex: jpg)', 'ext', '', 200, 120)
If @error Then Exit

_ArrayDisplay(_findfile($input))

Func _findfile($ext)
    Local $rets[1]
    Local $output = Run(@ComSpec & " /c " & 'dir ' & '"' & @HomeDrive & '\' & '' & '*.' & $ext & '" /b /s', '', @SW_HIDE, 2)
    While 1
        $stdout = StdoutRead($output)
        If @error Then ExitLoop
        $found = StringSplit(StringStripCR($stdout), @LF)
        For $i = 1 To UBound($found) - 1
            If $found[$i] = '' Then ContinueLoop
            ReDim $rets[UBound($rets)+1]
            $rets[UBound($rets)-1] = $found[$i]
        Next
    WEnd
    $rets[0] = UBound($rets) - 1
    Return $rets
EndFunc
Edited by xcal
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...