Template request | Bug report | Generate Data Product
Tags: #python #naas #glob #pprint #snippet
Author: Ayoub Berdeddouch
Description: This notebook gives you the ability to get all files from a directory even in a sub-directory.
import glob
from os import path
dir_path = "" # If dir path is "", it will returned files from current folder
files = glob.glob(path.join(dir_path, "**"), recursive=True)
print(f"Total files and folders fetched:", len(files))
sorted(files)