for i in os.listdir(path_1): for j in os.listdir(path_2): file_name = (j.split('.')) if i.__contains__(file_name) and i.endswith('txt'): txt_tym = os.path.getctime(path_1 + '/' + i) log_tym = os.path.getctime(path_2 + '/' + j) if txt_tym >= log_tym: print('Issues found in: '+i) else: print('No issues found')
I'm using this program to compare timestamp between two files in two different directory, it has same names but different extension,
I need to show the result in a text document.If there is an issue it will print
Isues found in: filename.
I need to print
No issues found only if there is no single files with the issue,
Im using else inside the loop and it prints multiple times.
Please give some suggestions to this