title: How to list names of files in all directories and subdirectories in txt file in C?
body: <p>I would like to list all PDF files (CAD drawings) placed in directories and subdirectories corresponding with place in 3D model assembly also retaining information about level of each subdirectory. Drawing tree looks something like this ("[A]" states for assembly drawing"  - level is the same as that of parent directory):</p>
  
  <pre><code>DIR100
    DIR101
    DIR102
      [A]DRW102
      DRW1021
      DRW1022
      ...
    DIR103
      [A]DRW103
      DRW1031
      DRW1032
      ...
    ...
    [A]DRW100
    DRW1001
    DRW1002
  </code></pre>
  
  <p>So after executing a program, txt file should look like this:</p>
  
  <pre><code>LVL1 DIR100
    LVL2 DIR101
    LVL2 DIR102
      LVL2 [A]DRW102
      LVL3 DRW1021
  LVL3 DRW1022
      ...
  </code></pre>
  
  <p>This is the first step for the project. As soon as I have list of files, I am able to automatically rename them.</p>