for the people with similar issues, i fixt it with the following adjustments
import os
import re
pattern = r'\d{3}-\d{3}-\d{4}'
for folder, sub_folder, files in os.walk(r'/Users/alain/Downloads/extracted_content'):
for file in files:
if file.endswith('txt'):
with open(os.path.join(folder, file)) as stream:
for line in stream:
if re.search(pattern,line):
print("its in!")