Java Rename File renameTo(final File srcFile, final File dstfile)

Here you can find the source of renameTo(final File srcFile, final File dstfile)

Description

Rename File in privileged mode.

License

Open Source License

Parameter

Parameter Description
srcFile a parameter
dstfile a parameter

Declaration

public static boolean renameTo(final File srcFile, final File dstfile) 

Method Source Code


//package com.java2s;
/*//from  w ww .ja va 2 s.c  om
 * Copyright (C) 2003-2011 eXo Platform SAS.
 *
 * This program 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.
 *
 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.File;

public class Main {
    /**
     * Rename File in privileged mode.
     * 
     * @param srcFile
     * @param dstfile
     * @return
     */
    public static boolean renameTo(final File srcFile, final File dstfile) {

        return new Boolean(srcFile.renameTo(dstfile));

    }
}

Related

  1. renameTo(File currentFile, String newName)
  2. renameTo(File from, File to, boolean deleteDestination)
  3. renameTo(File fromFile, File toFile)
  4. renameTo(File orig, File dest)
  5. renameTo(File source, String newName)
  6. renameTo(String fileName, String targetFileName)
  7. renameToBackupName(File file)
  8. renameToBackupName(File file)
  9. renameToNextSequencedFile(String srcfile, String destfolder, String prefix, String suffix)