import glob all_files = [f for f in glob.glob(folder) if os.path.isfile(f)]
import os subfolders = [ f.path for f in os.scandir(folder) if f.is_dir() ]
os.walk(directory) [x[0] for x in os.walk(directory)]