In some cases, it is necessary to iterate recursively through the main directory to discover new directories. In this example, we see how we can browse a directory recursively and retrieve the names of all files within that directory:
import os # you can change the "/" to a directory of your choice for file in os.walk("/"): print(file)