bash loop over files in directory and subdirectories code example
Example 1: iterate through all files in directory python
import os
directory = 'the/directory/you/want/to/use'
for filename in os.listdir(directory):
if filename.endswith(".txt"):
#do smth
continue
else:
continue
Example 2: bash count files in directory recursively matchingattern
find . -type f -name '*.log' -printf x | wc -c