-1 works

How to list all files of a directory in Python


dashboard+ Project

Posted by @bravocoder #python

Code snippet:

import glob
print(glob.glob("/home/adam/*.txt"))
content_copyCopy to Clipboard

More details:

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

Code snippet source:

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

>> Browse more code snippets

more_vert