diff --git a/webSimple.py b/webSimple.py index 3ca5f78..4dcd6e6 100644 --- a/webSimple.py +++ b/webSimple.py @@ -1,4 +1,3 @@ - import os from datetime import datetime @@ -7,7 +6,9 @@ def generate_pdf_list_html(directory, output_file="pdf_list.html"): try: # Get a list of PDF files in the directory file_list = [f for f in os.listdir(directory) if f.endswith('.pdf')] - file_list.sort(key=lambda a: a.lower()) + + # Sort files by modification time (newest first) + file_list.sort(key=lambda f: os.path.getmtime(os.path.join(directory, f)), reverse=True) # Get the current timestamp generation_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")