黑芝麻的产地,遗忘的囚室,陈国桢
public static void main(string[] args) throws ioexception {
bufferedreader br = new bufferedreader(new filereader("output1.txt"));
list<string> newname = new arraylist<string>();
list<string> oldname = new arraylist<string>();
string line;
string[] col;
while((line=br.readline())!=null) {
col = line.split("#");
newname.add(col[0]);
oldname.add(col[1]);
}
br.close();
for(int i=0;i<newname.size();i++) {
file oldfile = new file("d:\\tddownload\\heihei\\"+oldname.get(i)+".mp4");
system.out.println(oldfile.exists());//看文件是否存在
file newfile = new file(oldfile.getparent()+file.separator+newname.get(i)+".mp4");
if(newfile.exists()) {
system.out.println(i+"已存在");//新文件已存在
} else {
system.out.println(i+"\t"+oldfile.renameto(newfile));//旧文件是否重命名成功
}
}
}
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论