Java Utililty Methods Rename File

List of utility methods to do Rename File

Description

The list of methods to do Rename File are organized into topic(s).

Method

voidrenameToTemporaryName(final File flFileToRename, final String strPrefix)
Rename the file to temporaty name with given prefix
assert strPrefix != null : "Prefix cannot be null.";
String strParent;
final StringBuffer sbBuffer = new StringBuffer();
File flTemp;
int iIndex = 0;
strParent = flFileToRename.getParent();
do {
    iIndex++;
...
voidrenameToUpperCase(File dir)
rename To Upper Case
File files[] = dir.listFiles();
if (files != null) {
    for (int i = 0; i < files.length; i++) {
        files[i].renameTo(new File(files[i].getParentFile(), files[i].getName().toUpperCase()));
        if (files[i].isDirectory()) {
            renameToUpperCase(files[i]);
booleanrenameWallpaper(String new_file_name, String old_file_name, Map dimmensions, String basepath, List resolution_directories)
reames a wallpaper and all its copies
Iterator<Entry<String, Integer>> entries = dimmensions.entrySet().iterator();
boolean ok_1 = true;
while (entries.hasNext()) {
    Entry<String, Integer> e = entries.next();
    File old_file = new File(basepath + File.separator + e.getKey() + File.separator + old_file_name);
    File new_file = new File(basepath + File.separator + e.getKey() + File.separator + new_file_name);
    if (ok_1 && new_file.exists()) {
        ok_1 = ok_1 && new_file.delete();
...
voidrenameWithConfirm(String tmpFilename, String filename)
rename With Confirm
if (!new File(tmpFilename).renameTo(new File(filename))) {
    throw new IOException("rename failed of " + filename);