I am Windows user. If I set the condition to "*1.jpg" then it lists a file ending with "2". (if I set condition to *2.jpg or *3.jpg those work fine)
Sub prob()
Dim x As String
x = Dir("C:\Users\" & Environ("UserName") & "\Downloads\folder\jpg\*" & "1" & ".jpg")
End Sub
There are 3 files: company 34 31.jpg (this is never listed) company 34 32.jpg (this is listed if condition is 1 or 2) company 34 33.jpg (this is listed if condition 3)
There are several other examples, like in other folder it returns a jpg file ending 2 while condition is *3.jpg. I can not find any logic or pattern in this. Png format seems to not work only with condition "*1.png" and for example by pdf format seems everything works without errors.
There are no hidden files, there is no 1000 lines of code to have multiple bug possibilites. It's just a single line. I want a file ending in a digit and other file will be returned.
Quite confusing situation for me and feels so bad I can't even figure out a pattern, just seems totally random.
2.
- see second screenshot: it seems like if there is a 1 digit ending file, and a lot of double digit ending files, then the 1 digit ending file takes precedence.



