public void generateDatasetFromBeginning(String datasetFile, HashMap<String, Integer> files, int numOperations) throws IOException {

		FileWriter fstream = new FileWriter(datasetFile);
		BufferedWriter out = new BufferedWriter(fstream);

		int fileNum = files.values().size() + 1;
		int totalFiles = fileNum - 1;

		Object[] filesPath = files.keySet().toArray();
		HashSet<String> folders = this.getFoldersFromFilesList(filesPath);

		ArrayList<Integer> operations = getOperationsListBeginning(numOperations);
		totalTime = 0;

		for (int opNum : operations) {

			switch (opNum % 3) {
			case 0:
				// ADD
				logger.debug("ADD");
				int newFileSize = this.random.nextInt(Config.getMaxSize() - Config.getMinSize() + 1) + Config.getMinSize();
				boolean created = createFile(newFileSize, fileNum, folders);

				// Select folder to copy the new file
				String path = "/";

				if (created) {
					String fileName = "file" + fileNum + ".dat";
					int time = this.getWaitTime();
					totalTime += time;
					Add addAction = new Add(totalTime, "/" + fileName, path);
					files.put(path + fileName, newFileSize);
					filesPath = files.keySet().toArray();
					out.write(addAction.toString());
					fileNum++;
					totalFiles++;
				}
				break;
			case 1:
				// UPDATE
				logger.debug("UPDATE");
				if (totalFiles <= 0) {
					continue;
				}
				Object fileToModify = filesPath[random.nextInt(totalFiles)];
				int fileSize = files.get(fileToModify);
				this.generateUpdate(out, fileToModify, fileSize);
				break;
			case 2:
				// REMOVE
				logger.debug("REMOVE");
				if (totalFiles <= 0) {
					continue;
				}
				String fileToRemove = (String) filesPath[random.nextInt(totalFiles)];
				totalFiles--;
				files.remove(fileToRemove);
				filesPath = files.keySet().toArray();
				int time = this.getWaitTime();
				totalTime += time;
				Remove remove = new Remove(totalTime, fileToRemove);
				out.write(remove.toString());
				break;
			}

		}

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

	}