I am using the following script to concatenate new files. The problem with this foreach loop , if I have two file on the same day in the folder, it will only upload the latest file (TP12-copy(2)) because it is 10:21 and it will ignore the TP12-Copy.
It depends on the ordering of the files within the folder and filelist() isn't an own Qlik function else just called a Windows function. AFAIK there is nothing what could be directly influenced on this feature unless you change the filenames manually or with an extra logic.
I'm not absolutely sure what your requirements are but I assume you could prevent this behaviour quite easily - by moving the statement: let vMaxDate = vDate; out of the loop below the next file statement. You may need some extra logic here to prevent that vMaxDate could be overwritten with a date in the past or is completely erased if no loop iteration is executed or any other unexpected stuff happens - maybe just: let vMaxDate = rangemax(vMaxDate, vDate);