Java Delete File deleteFile(String fileName)

Here you can find the source of deleteFile(String fileName)

Description

delete File

License

Open Source License

Declaration

static void deleteFile(String fileName) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2001, 2007 Oracle Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * /*from   www.j a va 2 s .  c om*/
 * Contributors:
 *     Oracle Corporation - initial API and implementation
 *******************************************************************************/

import java.io.File;

public class Main {
    static void deleteFile(String fileName) {
        File f = new File(fileName);
        if (f.exists()) {
            f.delete();
            if (f.exists())
                f.deleteOnExit();
        }
    }
}

Related

  1. deleteFile(String file)
  2. deleteFile(String file)
  3. deleteFile(String filename)
  4. deleteFile(String fileName)
  5. deleteFile(String fileName)
  6. deleteFile(String filename)
  7. deleteFile(String filename)
  8. deletefile(String fileName)
  9. deleteFile(String FileName)