Search all files with Python
GOAL
To trace all files in the directory with Python
Environment
WIndows 10
Python 3.8.6
Method
Use glob.glob(path +’/**’, recursive=True)
import glob import os path = "C:\\path\\direcotry" files = glob.glob(path +'/**', recursive=True) for file_item in files: print(file_item)
* If you don’t add recursive=True, only the directory defined as “path” is searched.