Java File Rename renameFile(File src, File dest, boolean overwrite)

Here you can find the source of renameFile(File src, File dest, boolean overwrite)

Description

rename File

License

Open Source License

Declaration

public static void renameFile(File src, File dest, boolean overwrite) 

Method Source Code

//package com.java2s;
/*/*from  www . java2s. c o  m*/
 * Copyright (c) 2008-2013 Maksim Khadkevich and Fondazione Bruno Kessler.
 *
 * This file is part of MART.
 * MART is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2, as published
 * by the Free Software Foundation.
 *
 * MART 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 General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with MART; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import java.io.*;

public class Main {
    public static void renameFile(File src, File dest, boolean overwrite) {
        if (dest.exists() && overwrite) {
            dest.delete();
        }
        src.renameTo(dest);
    }
}

Related

  1. renameFile(File file, String sign, String suffix)
  2. renameFile(File source, File dest)
  3. renameFile(File sourceFile, String newFileName)
  4. renameFile(File src, File dest)
  5. renameFile(File src, File dest)
  6. renameFile(File srcFile, File destFile)
  7. renameFile(File srcFile, File dstFile)
  8. renameFile(File srcFile, File renameToFile)
  9. renameFile(final File path, final String fname)