Here you can find the source of createRandomFolders(Path basePath, int numberOfFolders)
public static List<Path> createRandomFolders(Path basePath, int numberOfFolders) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; public class Main { private static int FOLDER_NUMBER = 0; public static List<Path> createRandomFolders(Path basePath, int numberOfFolders) throws IOException { List<Path> folders = new ArrayList<>(); for (int i = 0; i < numberOfFolders; ++i) { Path folder = createRandomFolder(basePath); folders.add(folder);/*from w w w. j av a 2 s . c o m*/ } return folders; } public static Path createRandomFolder(Path basePath) throws IOException { String folderName = "f" + FOLDER_NUMBER++; Path p = basePath.resolve(folderName); Files.createDirectory(p); return p; } }