-
Notifications
You must be signed in to change notification settings - Fork 0
/
consult_folder.py
68 lines (50 loc) · 1.54 KB
/
consult_folder.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os.path
import parameters as p
def result_qtd(source_folder, file_begin, file_end):
list_files = os.listdir(source_folder)
qtd_file = 0
for file in list_files:
if file_end in file:
if file_begin in file:
qtd_file += 1
return qtd_file
def result_file(source_folder):
list_files = os.listdir(source_folder)
return list_files
def duplicate_qtd(source_folder,identify_duplicate, identify_duplicate_final):
list_files = os.listdir(source_folder)
qtd_file = 0
for file in list_files:
if identify_duplicate in file:
if identify_duplicate_final in file:
qtd_file += 1
return qtd_file
def await_file(source_folder, file_begin, file_end):
list_files = os.listdir(source_folder)
qtd_file = 0
for file in list_files:
if file_begin in file:
if file_end in file:
qtd_file+=1
return qtd_file
if __name__ == '__main__':
concessionaria = 'Bandeirante'
print(
duplicate_qtd(
p.downloads_folder,
p.identify_file(concessionaria, 'begin', duplicate=True),
p.identify_file(concessionaria, 'end', duplicate=True)
)
)
print(
result_qtd(
p.downloads_folder,
p.identify_file(concessionaria, 'begin'),
p.identify_file(concessionaria, 'end')
)
)
print(await_file(
p.downloads_folder,
p.identify_file(concessionaria, 'begin'),
".ZIP.crdownload"
))