List specific files from directory and subdirectories
Tags: #python #glob #os #files #directory #subdirectories
Last update: 2023-05-31 (Created: 2023-05-31)
Description: This notebook list all specific files from a directory and its subdirectories using glob and os libraries. It is usefull to quickly list all files from a directory and its subdirectories.
References:
import glob
import os
directory
: path of the directory to list filesfile_extension
: extension of the files to list
directory = "./"
file_extension = "txt"
files = glob.glob(os.path.join(directory, "**/*." + file_extension), recursive=True)
files
Last modified 1mo ago