String getNPath(String fullPath) {
String AL = "";
int index = fullPath.lastIndexOf("\\");
String fileName = fullPath;
if (index >= 3) {
fileName = fullPath.substring(index + 1);
AL = fullPath.replaceAll(fileName, "") + "ENCRC6" + fileName;
} else {
index = fullPath.lastIndexOf("/");
if (index > 3) {
fileName = fullPath.substring(index + 1);
AL = fullPath.replaceAll(fileName, "") + "ENCRC6" + fileName;
} else {
int dot = fullPath.lastIndexOf(".");
String ext = fullPath.substring(dot + 1);
AL = fullPath + "ENCRC6." + ext;
}
}
return AL;
}
private boolean rename(File from, File to) {
return from.getParentFile().exists() && from.exists() && from.renameTo(to);
}
File currentFile = new File(NF);
File newFile = new File(NF2);
if (rename(currentFile, newFile)) {
//Success
cetak("Baca Rename", "Success Rename "+NF+" TO "+NF2);
cetak("Baca Hasil","File Berhasil di dekripsi ! lihat di : " + NF2);
sukses("Dekrip Sukses !","Cek Di:"+NF2);
} else {
//Fail
cetak("Baca Rename", "Fail Rename "+NF+" TO "+NF2);
cetak("Baca Hasil","File Berhasil di dekripsi ! lihat di : " + NF);
sukses("Dekrip Gagal !","Cek Di:"+NF);
}
Tidak ada komentar:
Posting Komentar