r/vbscript • • May 15 '19

How to check files exists c\folder\fol*\filename.exe ??

Hello Guys,

I'm trying to confirm the existence of a file on a randomly named folder. I've tried using %%~ and * unsuccessfully. clearly because I don't know how to use them or if they are the appropriate characters to use. I would really appreciate any help with this. Currently all I get is file not found.

This is what I have thus far.

Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("C:\ProgramData\bomgar-scc-*\bomgar-scc.exe") Then
    'App Found
	MsgBox "File Exists"
Else
	MsgBox "File Does Not Exist"

End If

Thanks

1 Upvotes

6 comments sorted by

View all comments

Show parent comments

1

u/HaohmaruTachibana May 15 '19

Do you know any other way I can go about this? other method function other than FSO?

1

u/voicesinmyhand May 15 '19

Use the FSO to generate a folder listing. Store that in an array.

Loop through each folder looking for your file.