Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r40314c67874695eefc506c3a6a33896495953edd -r316fd2f51b0fa89c0f69949d79ef246e1e4bc4ed --- shared/scripts/configuration/utility.py (.../utility.py) (revision 40314c67874695eefc506c3a6a33896495953edd) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 316fd2f51b0fa89c0f69949d79ef246e1e4bc4ed) @@ -1,15 +1,17 @@ ########################################################################### # -# Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +# Copyright (c) 2022-2025 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file utils.py - -# @author (last) LTTS -# @date (last) 15-Jan-2022 +# @file utility.py # +# @author (last) Behrouz NematiPour +# @date (last) 04-Feb-2025 +# @author (original) joseph_varghese +# @date (original) 19-Jan-2022 +# ############################################################################ import csv import glob @@ -636,7 +638,7 @@ #TODO: dynamic name try: current_date = get_current_date_and_time(date_format = "%Y_%m_%d") - latest_file = config.LOG_LOCATION + current_date + '_denaliSquish.log' + latest_file = config.LOG_LOCATION + current_date + '_SystemSetup.log' return latest_file except: return False @@ -866,7 +868,7 @@ newFileName = filename oldFileName = filename + "_1" if os.path.exists(path+newFileName): - # During running of AUT, the application re-creates the folder (eg: application/resources/settings) + # During running of AUT, the application re-creates the folder (eg: unittests/resources/settings) # need to delete before renaming shutil.rmtree(path+newFileName) if os.path.exists(path+oldFileName): @@ -875,6 +877,15 @@ else: test.log(str(oldFileName+" failed to rename to "+newFileName)) +def remove_files_in_folder(folder_path): + if not os.path.exists(folder_path): + return + + for filename in os.listdir(folder_path): + file_path = os.path.join(folder_path, filename) + os.remove(file_path) + + def vitals_interval_obj(interval): names.o_time_interval_obj["text"] = interval return names.o_time_interval_obj @@ -915,7 +926,7 @@ @return latest_file - (string) returns latest file that append on log folder from sd-data """ try: - list_of_files = glob.glob(config.POST_TREATMENT_LOG_LOCATION) + list_of_files = glob.glob(config.POST_TREATMENT_LOG_FILTER) latest_file = max(list_of_files, key=os.path.getctime) return latest_file except: