title: Getting all files under a folder and subfolders in a recursive manner, without the path of the subfolders itself
body: <p>I want to list all the full path of the files under a folder and all its subfolders recursively. Is there a way to do it? It seems that if the files go into 2 levels, the code can be written like is,</p>
  <pre><code>import os
  
  
  folderPATH = r'C:\Users\Arman\Desktop\Cosmology\Articles'
  filePATHS = [x[2] for x in os.walk(folderPATH)]
  
  for i in filePATHS:
      for j in i:
          print(j)
  </code></pre>
  <p>prints</p>
  <pre><code>Astrophysical Constants And Parameters.pdf
  desktop.ini
  Physics Latex Manuel.pdf
  Spactimes.pdf
  A parametric reconstruction of the cosmological jerk from diverse observational data.pdf
  A Thousand Problems in Cosmology Horizons.pdf
  An Almost Isotropic CM Temperature Does Not Imply An Almost Isotropic Universe.pdf
  Big Bang Cosmology - Review.pdf
  desktop.ini
  Expanding Confusion common misconceptions of cosmological horizons and the superluminal expansion of the universe.pdf
  Hubble Radius.pdf
  Is the Universe homogeneous.pdf
  LCDM and Mond.pdf
  Near galaxy clusters.pdf
  The Cosmological Constant and Dark Energy.pdf
  The mass of the Milky Way from satellite dynamic.pdf
  The Status of Cosmic Topology after Planck Data.pdf
  An upper limit to the central density of dark matter haloes from consistency with the presence of massive central black holes.pdf
  Dark Matter - Review.pdf
  Dark Matter Accretion into Supermassive Black Holes.pdf
  desktop.ini
  Andrew H. Jaﬀe - Cosmology - Imperial College Lecture Notes - Thermodynamics and Particle Physics.pdf
  Big Bang Nucleosynthesis.pdf
  Claus Grupen - Astroparticle Physics - The Early Universe.pdf
  Daniel Baumann - Cosmology - Mathematical Tripos III - Thermal History.pdf
  desktop.ini
  James Rich - Fundamentals of Cosmology - The Thermal History of the Universe.pdf
  Lars Bergström, Ariel Goobar - Cosmology and Particle Astrophysics -  Thermodynamics in the Early Universe.pdf  
  Steven Weinberg - Cosmology - The Early Universe.pdf
  Andrei Linde - On the problem of initial conditions for inﬂation.pdf
  ...
  </code></pre>
  <p>I want a function that produces the same results <strong>but with recursive logic and with the full paths</strong>. So that for <code>n</code> nested folders, I can find the paths. I need something like this,</p>
  <pre><code>import os
  
  def get_all_filePATHs(folderPATH):
      ...
      return get_all_filePATHs()
  
  folderPATH = r'C:\Users\Arman\Desktop\Cosmology\Articles'
  print(get_all_filePATHs(folderPATH))
  </code></pre>
  <p>Note that I am only interested in the <strong>full path of the files and not the path of the subfolders</strong>, as you can see from the example above.</p>