How to execute a script in a bunch of files that ends with a keyword using VBS?

I want to execute a script on several files that are inside a folder but only for those files which ends with the keyword "qa"

for example:
I have a folder with a lot of below files
settingsqa.txt
settingsqb.txt
settings2qa.txt
settings2qb
configqa.txt
configqb.txt


and i want only execute the script for the ones:
settingsqa.txt
settings2qa.txt
configqa.txt
acunaaraAsked:
Who is Participating?
 
sirbountyCommented:
Something like this...

dim objfso: set objfso = createobject("scripting.filesystemobject")
dim objFolder : set objfolder = objfso.getfolder("c:\temp")
for each oFile in objFolder.Files
  if lcase(objfso.getextensionname(ofile)) = "txt" then
    strFilename = objFSO.getbasename(ofile)
    if lcase(right(strFilename,2)) = "qa" then
      'do something
    end if
  end if
next

Open in new window

0
 
acunaaraAuthor Commented:
Excellent!! Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.