Answered by : adventurous-armadillo-bk53yrwqajve
import os
my_list = os.listdir('My_directory')
Source : https://stackoverflow.com/questions/31049648/how-to-get-list-of-subdirectories-names/31049721 | Last Update : Mon, 15 Jun 20
Answered by : blushing-badger-gx3qb8p1v3db
import os
print(os.listdir('/path/to/folder/to/list'))
Source : | Last Update : Wed, 29 Apr 20
Answered by : excited-eagle-w9stcl6o7xop
import os
path = '/folder1/folder2/'
files = os.listdir(path)
Source : | Last Update : Wed, 27 Jan 21
Answered by : georgiy-kantsedal
import glob
print(glob.glob("/home/adam/*"))
Source : | Last Update : Wed, 23 Mar 22
Answered by : jasmine-bhanushali
import os
folder_path = "./folder-path"
for path, currentDirectory, files in os.walk(folder_path): for file in files: if not file.startswith("."): print(os.path.join(path, file))
Source : | Last Update : Fri, 21 Oct 22
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 : 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 : 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