code: public static boolean renameFile(final File fileToRename, final File newFileName,
  		final boolean delete) throws IOException, FileIsADirectoryException
  	{
  		boolean success = fileToRename.renameTo(newFileName);
  		if (!success)
  		{
  			if (delete)
  			{
  				CopyFileExtensions.copyFile(fileToRename, newFileName);
  				DeleteFileExtensions.delete(fileToRename);
  				success = true;
  			}
  		}
  		return success;
  	}
docs: This method renames a given file. For instance if we have a file which we want to rename with
  the path "/tmp/test.dat" to "/tmp/renamed.dat" then you call the method as follow:
  renameFile(new File("C://tmp//test.dat"), new File("C://tmp//renamed.dat"));
  
  @param fileToRename
  The file to rename.
  @param newFileName
  The new name from the file.
  @param delete
  If true an attempt to copy the content from the file to rename to the new file and
  then delete the file to rename otherwise not.
  @return 's true if the file was renamed otherwise false.
  @throws IOException
  Signals that an I/O exception has occurred.
  @throws FileIsADirectoryException
  the file is A directory exception