This method should be reworked anyway: it does not respects the order of the files.