title: Read files in subfolders
body: <p>I'm trying to make a script that we can output a specific string ino a files from a list of files in different subfolders.</p>
  
  <p>My script works but onl for one directory. I need some help to make it works with subfolders</p>
  
  <pre><code>Const ForReading = 1
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set folder = objFSO.GetFolder("D:\vbs\logs\") ' here i have loads of subfolders with *.txt 
  Set outfile = objFSO.CreateTextFile("D:\vbs\ok\test.txt") ' my output file
  
  for each file in folder.Files
      Set testfile = objFSO.OpenTextFile(file.path, ForReading)
  
      Do While Not testfile.AtEndOfStream
  
          If instr (testfile.readline, "central") then ' i output every lines where there is the word "central" 
              outfile.writeline testfile.readline
          End If
  
          if instr (testfile.readline, "version") then  ' i use this to parse my output file to get a indication between every files read
  
              num = testfile.readline
              mag = Split(num)
          elseif testfile.AtEndOfStream = true then
              outfile.writeline "Shop " &amp; mag(4)
          end if
      Loop
      testfile.close
  next
  outfile.close
  </code></pre>