8
8
import string
9
9
from urllib .error import URLError
10
10
from urllib .request import *
11
-
12
11
import docx
13
12
import openpyxl
13
+ import logging
14
+ import threading
15
+ import time
16
+ from tqdm import tqdm
14
17
15
18
# import PyPDF2
16
19
# import re
27
30
ftp = ftplib .FTP ()
28
31
29
32
33
+ def thread_function (name ):
34
+ rstqdm = tqdm (range (100 ))
35
+ time .sleep (2 )
36
+ # logging.info("Scan started %s: loading...", name)
37
+ for i in rstqdm :
38
+ time .sleep (1 )
39
+ if i == 100 :
40
+ rstqdm .clear ()
41
+ logging .info ("Please wait scan is in progress..." )
42
+
43
+
30
44
def _rS_sign ():
31
45
print ("\n ><----------------------------------------------><\n " )
32
46
print ("|" "---------" " " "------------" )
@@ -63,7 +77,7 @@ def _rSInternet_Check_(): # Internet Tester
63
77
64
78
def _RsBackupWriter (rrs , pp ): # local backup (unfinished)
65
79
global j
66
- print ('BACKUP FOLDER STARTED /N rvs len : ' , len (rrs ))
80
+ print ('BACKUP FOLDER STARTED \n Total File address written : ' , len (rrs ))
67
81
trs = open (pp , "a" )
68
82
for item in rrs :
69
83
trs .write ("%s\n " % item )
@@ -207,19 +221,26 @@ def main():
207
221
# print('Selected file type = ', val)
208
222
rss = []
209
223
210
- bck_dir = "rrs " # LINE 154 - 166 REFERS LOCAL BACKUP (UNFINISHED)
211
- bck_file = "rrs .txt"
212
- print ('Hidden folder named rss is created in first local drive from available drive list' )
224
+ bck_dir = "RSSF " # LINE 154 - 166 REFERS LOCAL BACKUP (UNFINISHED)
225
+ bck_file = "RSSF .txt"
226
+ print ('Reuslt folder named RSSF is created in first local drive from available drive list' )
213
227
pth = os .path .join (rs [0 ], bck_dir )
214
228
if os .path .exists (pth ): # this if will flush the old backup folder and re-create new backup folder
215
229
shutil .rmtree (pth )
216
230
os .makedirs (pth )
217
- print ('Hidden folder path: ' , pth )
218
- print ('Hidden file text .txt is created in hidden folder rss' )
231
+ print ('Result folder path: ' , pth )
232
+ print ('Result file RSSF .txt is created in hidden folder rss' )
219
233
CN = os .path .join (pth , bck_file )
220
- print ('Hidden file location: ' , CN )
234
+ print ('Result file location: ' , CN )
221
235
file1 = open (CN , "a" )
222
236
file1 .close ()
237
+
238
+ format = "%(asctime)s: %(message)s"
239
+ logging .basicConfig (format = format , level = logging .INFO ,
240
+ datefmt = "%H:%M:%S" )
241
+ x = threading .Thread (target = thread_function , args = (1 ,))
242
+ x .start ()
243
+
223
244
if _rS_sign ():
224
245
print ('Below files are present in system: ' "\n " )
225
246
while i != len (rs ):
@@ -259,6 +280,8 @@ def main():
259
280
i += 1
260
281
else :
261
282
exit ()
283
+ x .join ()
284
+ logging .info ("Master Control RSSF : Check " + CN + " For result data" )
262
285
print ('\n System scan completed\n ><----------------------------------------------><\n SCAN RESULTS' )
263
286
# print(rss)
264
287
print ('Searched Text:' , ff )
@@ -272,7 +295,7 @@ def main():
272
295
'''
273
296
_Rs_ftp_COPY_()
274
297
_rS_FTP_file_transf(rvs) #ONLY FOR FTP '''
275
- print ('calling backup' )
298
+ print ('\n ><---------------------------------------------->< \n calling backup' )
276
299
_RsBackupWriter (rvs , CN ) # LOCAL BACKUP CREATOR
277
300
278
301
0 commit comments