Sign in to follow this  
Followers 0
autoitquestion

variable into wildcard

2 posts in this topic

#1 ·  Posted (edited)

Hi,

How can I combine variable into wildcards?

I tried:

$search = FileFindFirstFile("C:\temp\*getName_$var*")

and:

$search = FileFindFirstFile("C:\temp\*getName_"&$var&"*")

Both, did not help

pls advice..

Edited by autoitquestion

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This worked for me, both files will be showed:

I created these 2 files in c:\temp (Test_getname_001.txt and Test_getname_002.txt) and used this code from help file:

$var = "00"
; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile("C:\temp\*getName_" & $var & "*")

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop

    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)

Br,

UEZ

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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