public HashMap<String, Integer> fillFoldersWithFiles(int minFileSize, int maxFileSize) throws FoldersNotCreated, IOException {

		if (!this.foldersCreated) {
			throw new FoldersNotCreated();
		}

		FileWriter fstream = new FileWriter(this.fsFolder + files_created);
		BufferedWriter out = new BufferedWriter(fstream);

		int freeSpace = totalData;
		boolean fsFilled = false;
		int totalFilled = 0;
		int totalFiles = 0;

		while (!fsFilled) {

			int newFileSize = this.random.nextInt(maxFileSize - minFileSize + 1) + minFileSize;
			freeSpace -= newFileSize;
			totalFilled += newFileSize;
			totalFiles++;

			boolean created = this.createFile(newFileSize, totalFiles, out);

			if (!created) {
				totalFiles--;
				freeSpace += newFileSize;
				totalFilled -= newFileSize;
			}

			if (maxFileSize * 2 > freeSpace) {
				logger.debug("Total data almost done.");
				fsFilled = true;
			}
		}

		logger.debug("Create two files of " + (freeSpace / 2));
		this.createFile(freeSpace / 2, totalFiles + 1, out);
		this.createFile(freeSpace / 2, totalFiles + 2, out);
		totalFilled += freeSpace;
		logger.debug("Created " + totalFilled + " kbytes from the total " + totalData);
		totalFiles += 2;
		logger.debug("Total files created: " + totalFiles);

		out.close();
		fstream.close();

		return this.files;

	}