public static void main(String[] args) يلقي IOException {
BufferedReader br = new BufferedReader(new FileReader("output1.txt"));
List<String> newName = new ArrayList<String>();
List<String> oldName = new ArrayList<String>();
خط السلسلة؛
String[] col;
بينما ((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");
إذا (newFile.exists()) {
System.out.println(i+"موجود بالفعل"); // الملف الجديد موجود بالفعل
} آخر {
System.out.println(i+"/t"+oldFile.renameTo(newFile));// ما إذا تمت إعادة تسمية الملف القديم بنجاح
}
}
}
}