this while will end on first existed input file, so with your 4 threads you will process only 4 files