In Python ,you can list all files of a directory using the os.listdir().
How do list all files of a directory in Python?
You can use the os.listdir() in pythpn which will list all the files that is in the directory includes files and directories. Incase you want just the files , you can filter it using the path function.
from os import listdir from os.path import isfile, join onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
Leave a Reply