Answered by : blushing-badger-gx3qb8p1v3db
import os
print(os.listdir('/path/to/folder/to/list'))
Source : | Last Update : Wed, 29 Apr 20
Answered by : moshi-wei
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
Source : | Last Update : Sat, 11 Apr 20
Answered by : jan-r
import os arr = os.listdir() print(arr) >>> ['$RECYCLE.BIN', 'work.txt', '3ebooks.txt', 'documents']
Source : https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory | Last Update : Thu, 22 Apr 21
Answered by : georgiy-kantsedal
import glob
print(glob.glob("/home/adam/*"))
Source : | Last Update : Wed, 23 Mar 22
Answered by : excited-eagle-w9stcl6o7xop
import os
path = '/folder1/folder2/'
files = os.listdir(path)
Source : | Last Update : Wed, 27 Jan 21
Answered by : spotless-swan-f7m0lmzpi0q6
lstJson = [f for f in os.listdir(str(self.pathJson)) if f.endswith('.json')] return lstJson
Source : | Last Update : Sun, 04 Apr 21
Answered by : determined-dolphin-jsoserb5x5ka
from os import listdir
file_list = listdir(folder_path)
Source : https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory | Last Update : Wed, 27 Jan 21
Answered by : different-dormouse-0a8c01ggfm3r
from os import walk
f = []
for (dirpath, dirnames, filenames) in walk(mypath): f.extend(filenames) break
Source : https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory | Last Update : Wed, 02 Feb 22