88import string
99from urllib .error import URLError
1010from urllib .request import *
11-
1211import docx
1312import openpyxl
13+ import logging
14+ import threading
15+ import time
16+ from tqdm import tqdm
1417
1518# import PyPDF2
1619# import re
2730ftp = ftplib .FTP ()
2831
2932
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+
3044def _rS_sign ():
3145 print ("\n ><----------------------------------------------><\n " )
3246 print ("|" "---------" " " "------------" )
@@ -63,7 +77,7 @@ def _rSInternet_Check_(): # Internet Tester
6377
6478def _RsBackupWriter (rrs , pp ): # local backup (unfinished)
6579 global j
66- print ('BACKUP FOLDER STARTED /N rvs len : ' , len (rrs ))
80+ print ('BACKUP FOLDER STARTED \n Total File address written : ' , len (rrs ))
6781 trs = open (pp , "a" )
6882 for item in rrs :
6983 trs .write ("%s\n " % item )
@@ -207,19 +221,26 @@ def main():
207221 # print('Selected file type = ', val)
208222 rss = []
209223
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' )
213227 pth = os .path .join (rs [0 ], bck_dir )
214228 if os .path .exists (pth ): # this if will flush the old backup folder and re-create new backup folder
215229 shutil .rmtree (pth )
216230 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' )
219233 CN = os .path .join (pth , bck_file )
220- print ('Hidden file location: ' , CN )
234+ print ('Result file location: ' , CN )
221235 file1 = open (CN , "a" )
222236 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+
223244 if _rS_sign ():
224245 print ('Below files are present in system: ' "\n " )
225246 while i != len (rs ):
@@ -259,6 +280,8 @@ def main():
259280 i += 1
260281 else :
261282 exit ()
283+ x .join ()
284+ logging .info ("Master Control RSSF : Check " + CN + " For result data" )
262285 print ('\n System scan completed\n ><----------------------------------------------><\n SCAN RESULTS' )
263286 # print(rss)
264287 print ('Searched Text:' , ff )
@@ -272,7 +295,7 @@ def main():
272295 '''
273296 _Rs_ftp_COPY_()
274297 _rS_FTP_file_transf(rvs) #ONLY FOR FTP '''
275- print ('calling backup' )
298+ print ('\n ><---------------------------------------------->< \n calling backup' )
276299 _RsBackupWriter (rvs , CN ) # LOCAL BACKUP CREATOR
277300
278301
0 commit comments