write the correct number of files.