#singleinstance setbatchlines, -1 path = 20d04fe0-3aea-1069-a2d8-08002b30309d iniread, PATH, CTN.INI, LOGS,Folder fileselectfolder, PATH, *%path% iniwrite, %path%, CTN.INI, logs, folder msgbox, 4,, Delete the Log Files? loop, %path%/*.txt { loop, read, %a_loopfilefullpath% { if a_loopreadline contains Lost connection { stringleft,f1, a_loopreadline,20 F1 = %F1% stringright, F2, a_loopreadline,22 f2 = %f2% fileappend,%f1%`,%f2%`n, %path%/LogOuts_%a_yyyy%-%a_MM%.csv } } ifmsgbox yes filedelete, %a_loopfilefullpath% }