app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import os def list_files_scandir(path='.'): with os.scandir(path) as entries: for entry in entries: if entry.is_file(): print(entry.path) elif entry.is_dir(): list_files_scandir(entry.path) # Specify the directory path you want to start from directory_path = './' list_files_scandir(directory_path) |