Jump to content
Sign in to follow this  
stuka

...

Recommended Posts

stuka

.

Edited by stuka

Share this post


Link to post
Share on other sites
Paulie

I don't know if recursive searching into directories is supported. It might be worth a search through example scripts though.

Share this post


Link to post
Share on other sites
xcal

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

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  

×