-1 works

How to list all files of a directory in Python


dashboard

Posted by @bravocoder #python

import glob
print(glob.glob("/home/adam/*.txt"))
content_copy

Will return a list with the queried files: ['/home/adam/file1.txt', '/home/adam/file2.txt', .... ]

https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory

>> Browse more code snippets

more_vert