list all the files in directory python code example
Example 1: python get all file names in directory
import glob
print(glob.glob("/home/adam/*.txt"))
Example 2: get list of files in directory python
import os
path = '/folder1/folder2/'
files = os.listdir(path)