File source=new File(fname1);
System.out.println("souce name "+fname1);
File dest = new File("F:\\BackupFiles",source.getName());
try
{
FileUtils.moveFile(source, dest);
source.delete();
}
catch (IOException ex)
{
Logger.getLogger(FileCompare.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println("file moved successfully...");
the above code throws exception
"java.io.IOException: Failed to delete original file 'C:\xampp\htdocs\eyeOS\eyeos\users\ajkani\files\html.txt' after copy to 'F:\BackupFiles\html.txt' "
and i tried to delete the file after copied it to the destination but unable to delete.
i tried deleteOnExit() method instead of delete() but nothing works.
i have used md5 algorithm to check the similarity of two files. if the files are not same.i want to move the files to destination directory.
writeright. - sp00m