glob.iglob function
import glob
import os
rootDir = 'test_dir'
files = []
for filePath in glob.iglob(rootDir + '**/**', recursive=True):
if os.path.isfile(filePath):
files.append(filePath)
print(files)
import glob
import os
rootDir = 'test_dir'
files = []
for filePath in glob.iglob(rootDir + '**/**', recursive=True):
if os.path.isfile(filePath):
files.append(filePath)
print(files)
Leave a Comment
Cancel reply