Here you can find the source of createPath(String fileName, String subfolder)
private static Path createPath(String fileName, String subfolder)
//package com.java2s; /* FileHelper.java/*from ww w. j a v a 2 s . c om*/ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Copyright ? 2014-2015 Universiteit Gent * * This file is part of the Degage Web Application * * Corresponding author (see also AUTHORS.txt) * * Kris Coolsaet * Department of Applied Mathematics, Computer Science and Statistics * Ghent University * Krijgslaan 281-S9 * B-9000 GENT Belgium * * The Degage Web Application is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The Degage Web Application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with the Degage Web Application (file LICENSE.txt in the * distribution). If not, see http://www.gnu.org/licenses/. */ import java.nio.file.Path; import java.nio.file.Paths; import java.util.UUID; public class Main { private static Path createPath(String fileName, String subfolder) { return Paths.get(subfolder, UUID.randomUUID() + "-" + fileName.replace("/", "-").replace("\\", "-")); } }