<jupyter_start><jupyter_text>How to list files with a common extension from a specified directory but no directories or subdirectories? (Method 1)<jupyter_code>import pandas as pd
from pathlib import Path
import time

p = Path("C:/SASCourse/Week1")
all_files = []
for i in p.rglob('*.SAS'):
    all_files.append((i.name, time.ctime(i.stat().st_ctime)))

columns = ["File_Name", "Created"]
df = pd.DataFrame.from_records(all_files, columns=columns)
xdf=df.iloc[:,[0]]
print(xdf.to_string(index=False))<jupyter_output><empty_output><jupyter_text>How to list files with a common extension from a specified directory but no directories or subdirectories? (Method 2)<jupyter_code>import glob
path = 'C:\\SASCourse\Week1\\'
files = (f for f in glob.glob(path + '**/*.sas', recursive=True))
for f in files:
    print(f)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13539192399049882, 'fraction_numerical': 0.0059382422802850355, 'mean_word_length': 6.1440677966101696, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '167431', 'license': 'MIT', 'n_tokens_mistral': 303, 'n_tokens_neox': 292, 'n_words': 79, 'path': 'Week1/_Week1_List_SAS_Programs.ipynb', 'repo_name': 'ProcJimi/curriculum', 'size': '842'}