Java is a complete introduction of object-oriented programming. It was an open source programming and right is being charged by oracle since oracle is the one to maintain java which might have been real.
Example code as:
package DownloadTheStatistic;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class FileNameOps {
public static void main(String[] argv) throws IOException {
File folder = new File("C:\Downloads");
File[] listOfFiles = folder.listFiles();
int m2Only = 1;
for (int i = 0; i < listOfFiles.length; i++) {
String oldF=listOfFiles[i].getName();
if (oldF.contains("QuickMobile Regression and Release_")){
File f = new File("C:\Downloads\"+oldF);
if (oldF.contains("App")||oldF.contains("(1)")) {
String z;
if(oldF.contains("App")&& oldF.contains("(1)")){
String x = oldF.substring(0, oldF.indexOf("")+1);
String y =oldF.substring(oldF.lastIndexOf(""));
z= x+"App_M2"+y.substring(0, y.indexOf("(")-1)+y.substring(y.lastIndexOf("."));
}else if(oldF.contains("App")){
String x = oldF.substring(0, oldF.indexOf("")+1);
String y =oldF.substring(oldF.lastIndexOf(""));
z= x+"App_M1"+y;
}else if(oldF.contains("Tab")){
String x = oldF.substring(0, oldF.indexOf("")+1);
String y =oldF.substring(oldF.lastIndexOf(""));
z= x+"Tab_M2"+y.substring(0, y.indexOf("(")-1)+y.substring(y.lastIndexOf("."));
}else{
String x = oldF.substring(oldF.lastIndexOf(""), oldF.indexOf("(")-1);
String y =oldF.substring(oldF.lastIndexOf("."));
z= oldF.substring(0, oldF.lastIndexOf(""))+"M2"+x+y;
}
f.renameTo(new File("C:\Downloads\"+z));
}else if(m2Only==1){
String y;
if(oldF.contains("Tab")){
y = oldF.substring(0, oldF.indexOf(""))+"Tab_M2"+oldF.substring(oldF.lastIndexOf(""));
}else{
String x = oldF.substring(oldF.lastIndexOf(""));
y= oldF.substring(0, oldF.lastIndexOf(""))+"M2"+x;
}
f.renameTo(new File("C:\Downloads\"+y));
}
else{
String y;
if(oldF.contains("Tab")){
y = oldF.substring(0, oldF.indexOf(""))+"Tab_M1"+oldF.substring(oldF.lastIndexOf(""));
}else{
String x = oldF.substring(oldF.lastIndexOf(""));
y= oldF.substring(0, oldF.lastIndexOf(""))+"_M1"+x;
}
f.renameTo(new File("C:\Downloads\"+y));
}
}
}
System.out.println("conversion is done");
}
}