Getting all CSV files in directory and subdirectories using Python

Below is the code import os from glob import glob PATH = “/home/someuser/projects/someproject” EXT = “*.csv” all_csv_files = [file for path, subdir, files in os.walk(PATH) for file in glob(os.path.join(path, EXT))] print(all_csv_files) That’s it !! While above code is written for searching csv files recursively in directory and subdirectory; it can be used to search for […]