Are you using the `-U` option of `ls` to sort by file creation? In some systems `-U` option means no sorting at all, so this is not a reliable approach.