File size: 812 Bytes
0b7778d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
#import streamlit as st
import tempfile

#donde se almacenan los ficheros subidos por usuario
FILE_LIST = "ficheros.txt"

#funcion para cargar ficheros 
def load_name_files(path):

    archivos = []
    with open(path, "r") as file:
        for line in file:
            archivos.append(line.strip())

    return archivos

#informa nombres de ficheros a ser almacenados
def save_name_files(path, new_files):

    old_files = load_name_files(path)

    with open(path, "a") as file:
        for item in new_files:
            if item not in old_files:
                file.write(item + "\n")
                old_files.append(item)
    
    return old_files

#limpieza de los ficheros
def clean_files(path):
    with open(path, "w") as file:
        pass
    return True