forked from shreyaskapale/OpenHacktoctober
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Binod_detector.py
57 lines (37 loc) · 1007 Bytes
/
Binod_detector.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
import os
folders = os.listdir()
# print(folders)
path = os.getcwd()
# print(path)
# pdfs = []
# total = {}
# Binod_in = []
print('#'*35, 'binod detector results', '#'*35)
for folder in folders:
if folder == 'Binod_detector.py':
pass
else:
Binod_in = ''
names = ''
new_path = path+'\\'+folder
os.chdir(new_path)
# print(os.getcwd())
# os.chdir(path)
files = os.listdir()
# print(file)
binod = [file for file in files if file.split('.')[0].lower()=='binod']
for name in binod:
names += name+','
binod_file = len(binod)
for file in files:
if file.endswith('txt'):
with open(file, 'r') as f:
if 'binod' in f.read().lower():
Binod_in += file+', '
print(f'\nBinod name found in {binod_file} files in {folder} folder: {names}',end='')
if len(Binod_in)>0:
print(f' and binod was hidden inside {Binod_in} files.')
else:
print('New line /n')
# print(total)
# print(pdf)