Here you can find the source of deleteFile(Path path)
Parameter | Description |
---|---|
path | The file path to delete |
public static void deleteFile(Path path)
//package com.java2s; /* FileHelper.java/*from ww w . jav a2s .co m*/ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * 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.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { private static String UPLOAD_FOLDER; /** * Deletes a file relative to the upload path * * @param path The file path to delete * @returns Whether the delete operation was successfull */ public static void deleteFile(Path path) { try { Files.delete(Paths.get(UPLOAD_FOLDER).resolve(path)); } catch (IOException ex) { // ignore } } }