solution doesn't work. each thread check check the same file each time cause you call file_number++; and then file_number--;