How to List All Files/Folders/Directories in Python


If you need to list all Files, Folders, or Directories in Python code, then you can use the listdirs method from the os package.

import os
print(os.listdir("/path/to/directory/")