Java File Path Delete delFile(String filePathAndName)

Here you can find the source of delFile(String filePathAndName)

Description

del File

License

LGPL

Declaration

public static void delFile(String filePathAndName) 

Method Source Code

//package com.java2s;
/*/* w w  w .ja v a  2 s .  c  om*/
 * Copyright (C) 2001-2004 Gaudenz Alder
 * 
 * 6/01/2006: I, Raphpael Valyi, changed back the header of this file to LGPL
 * because nobody changed the file significantly since the last
 * 3.0 version of GPGraphpad that was LGPL. By significantly, I mean: 
 *  - less than 3 instructions changes could honnestly have been done from an old fork,
 *  - license or copyright changes in the header don't count
 *  - automaticaly updating imports don't count,
 *  - updating systematically 2 instructions to a library specification update don't count.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
    
 * This library 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
 * Lesser General Public License for more details.
    
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

public class Main {
    public static void delFile(String filePathAndName) {
        try {
            String filePath = filePathAndName;
            filePath = filePath.toString();
            java.io.File myDelFile = new java.io.File(filePath);
            myDelFile.delete();

        } catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();

        }

    }
}

Related

  1. deleteWallpaper(String file_name, Map dimmensions, String basepath, List resolution_directories)
  2. delFile(String filePath)
  3. delFile(String filePath, String fileName)
  4. delFile(String filePathAndName)
  5. delFile(String filePathAndName)
  6. delFile(String filePathAndName)
  7. DelFile(String in_Path, ArrayList arrFileList)
  8. delFile(String path)
  9. delFile(String pathName)