Jump to content
Sign in to follow this  

Search for filename

Recommended Posts

I tried searching for it in the forum, but couldn't find anything that was of use. Are there any search for filename udf's or searching for keywords in filenames? If not, any idea how I could go about making this?

Share this post

Link to post
Share on other sites

$returncode = _FileSearch(@HomeDrive & '\*.au3')
If IsArray($returncode) Then
    For $i = 0 To UBound($returncode) - 1
        MsgBox(64, 'info', $returncode[$i])

Func _FileSearch($s_Mask = '', $i_Recurse = 1)
    Local $s_Command = ' /c dir /B "'
    If $i_Recurse = 1 Then $s_Command = ' /c dir /B /S "'
    Local $s_Buf = '', $i_Pid = Run(@ComSpec & $s_Command & $s_Mask & '"', @WorkingDir, @SW_HIDE, 2+4)
    ProcessSetPriority($i_Pid, 5)
    While Not @error
        $s_Buf &= StdoutRead($i_Pid)
    $s_Buf = StringSplit(StringTrimRight($s_Buf, 2), @CRLF, 1)
    If UBound($s_Buf) = 2 AND $s_Buf[1] = '' Then SetError(1)
    Return $s_Buf
EndFunc  ;==>_FileSearch

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...