changed sorting to newest in top
This commit is contained in:
parent
0d053ba70b
commit
2d07bc7471
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user