Projekt

Obecné

Profil

Stáhnout (958 Bajtů) Statistiky
| Větev: | Revize:
1 c8f3051b petrh
import os
2
import zipfile
3
from Utilities import ConfigureLoader
4
5
6
def list_of_all_files(path):
7
    files_in_dir = os.listdir(path)
8
9
    ignore_set = load_ignore_set(path)
10
11
    return set(files_in_dir).difference(ignore_set)
12
13
14
def load_ignore_set(path):
15
    ignore_set = set()
16
17
    with open(path + "ignore.txt", "r") as file:
18
19
        for line in file:
20
            ignore_set.add(line[:-1])
21
22
    return ignore_set
23
24
25
def update_ignore_set(path,file_name):
26
27
    with open(path + "ignore.txt", "a") as file:
28
        file.write(file_name + '\n')
29
30
31
def unzip_all_csv_zip_files_in_folder(folder):
32
33
    files_in_dir = os.listdir(folder)
34
    zips = []
35
36
    for file in files_in_dir:
37
        if file.endswith(".zip"):
38
            zips.append(folder + file)
39
40
    for zip_file in zips:
41
42
        with zipfile.ZipFile(zip_file, "r") as unziped_file:
43
            unziped_file.extractall(folder)
44
45
        os.remove(zip_file)
46
47