Here you can find the source of renameFile(final String oldName, final String newName)
Parameter | Description |
---|---|
oldName | a parameter |
newName | a parameter |
public final static boolean renameFile(final String oldName, final String newName)
//package com.java2s; /*//from w ww . j a v a2 s . c o m * Copyright (c) 2006 Stephan D. Cote' - All rights reserved. * * This program and the accompanying materials are made available under the * terms of the MIT License which accompanies this distribution, and is * available at http://creativecommons.org/licenses/MIT/ * * Contributors: * Stephan D. Cote * - Initial API and implementation */ import java.io.File; public class Main { /** * rename a file * * @param oldName * @param newName * * @return true if succeeded */ public final static boolean renameFile(final String oldName, final String newName) { final File f_old = new File(oldName); final File f_new = new File(newName); final boolean ret = f_old.renameTo(f_new); return ret; } }