1
0
forked from BgLUG/bglug.it
bglug.it/content/linuxday/2008/foto/elencofile.py
paspo 5e62b42f49 sezione linuxday (#104)
fixes #81

Reviewed-on: BgLUG/bglug.it#104
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
2024-07-14 09:50:14 +00:00

17 lines
559 B
Python

import os
# Ottieni il percorso della directory corrente
current_dir = os.getcwd()
# Crea una lista dei file nella directory corrente
file_list = os.listdir(current_dir)
# Apri un file di testo in modalità di scrittura
with open("file_list.txt", "w") as file:
# Scrivi ogni file nella lista sul file di testo, separato da una nuova riga
for filename in file_list:
file.write("[{{< figure src=\"" + filename + "\" title=\"abc\" width=\"20%\" >}}](" + filename + ")" + "\n")
print("L'elenco dei file è stato salvato in 'file_list.txt'.")