Put the jar file in
particular location in your machine and provide that path in your code as I have
provided as D://apache-tomcat-8.0.39//webapps//examples//test
_____________________________________________________________________________________
Code:
_____________________________________________________________________________________
import java.io.File;
public class Test {
public static void main(String[] args) {
File
dir = new File("D://apache-tomcat-8.0.39//webapps//examples//test");
File[]
filesList = dir.listFiles();
int i=1;
for (File file : filesList) {
if (file.isFile()) {
File
oldfile =new File("D://apache-tomcat-8.0.39//webapps//examples//test//"+file.getName());
File
newfile =new File("D://apache-tomcat-8.0.39//webapps//examples//test//"+file.getName().replaceAll("__V1.0.jar", ".jar"));
oldfile.renameTo(newfile);
System.out.println(file.getName().replaceAll("__V1.0.jar", ".jar"));
}
}
}
}
_____________________________________________________________________________________
No comments:
Post a Comment