title: Scan directory and subdirectories for .txt files
body: <p>I've got a task in which I get a string and a path to a directory and I must open every .txt file from that directory and all subdirectories and print all the .txt in which I could find that string.</p>
  
  <p>I managed to get the path to those .txt files in the directory, but I cannot go further to the subdirectories.
  Is there any command to do this? In Python I used:</p>
  
  <pre><code>for path, dirs, files in os.walk(dirPath):
          for f in files:
              if f.endswith('.txt'):
  </code></pre>
  
  <p>But i cannot find a command like that in c++. </p>
  
  <p>Thanks</p>