Search all files with Python
GOAL
To trace all files in the directory with Python
![](https://s-nako.work/wp/wp-content/uploads/2020/10/search_directory01.png)
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.