Java Rename File rename(String srcPath, String destPath)

Here you can find the source of rename(String srcPath, String destPath)

Description

rename

License

Open Source License

Declaration


public static void rename(String srcPath, String destPath) 

Method Source Code

//package com.java2s;
/* FileUtils/*from  ww  w .  ja  v  a 2s . co  m*/
 *
 * $Id: FileUtils.java 5863 2008-07-10 21:38:48Z gojomo $
 *
 * Created on Feb 2, 2004
 *
 * Copyright (C) 2004 Internet Archive.
 *
 * This file is part of the Heritrix web crawler (crawler.archive.org).
 *
 * Heritrix is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * any later version.
 *
 * Heritrix 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 Public License for more details.
 *
 * You should have received a copy of the GNU Lesser Public License
 * along with Heritrix; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import java.io.File;

public class Main {
    /**
     * rename
     */

    public static void rename(String srcPath, String destPath) {
        File file = new File(destPath);
        file.delete();
        file = new File(srcPath);
        file.renameTo(new File(destPath));
    }
}

Related

  1. rename(String oldName, String newName)
  2. reName(String oldName, String newName)
  3. rename(String platformLibPath, String newPath)
  4. reName(String s, String s1)
  5. rename(String srcFilename, String destFilename)
  6. rename(String strFileName, String strRenameToName)
  7. rename(String was_name, String new_name)
  8. rename_file_to_file(String n1, String n2)
  9. renameBackup(File backupFile)