if (!from.exists())
{
s_log.error("Cannot copy from file (" + from.getAbsolutePath() + ") which doesn't appear to exist.");
return;
}
FileWrapper toFile = to;
// Check to see if to is a directory and convert toFile to be the name of the file in that directory.
if (to.isDirectory())
{
toFile = getFile(to, from.getName());
}
if (s_log.isDebugEnabled())
{
s_log.debug("Copying from file (" + from.getAbsolutePath() + ") to file ("
+ toFile.getAbsolutePath() + ")");
}
if (toFile.exists())
{
long fromCheckSum = getCheckSum(from);
long toCheckSum = getCheckSum(toFile);
if (fromCheckSum == toCheckSum)
{
if (s_log.isInfoEnabled())
{
s_log.info("File to be copied(" + from.getAbsolutePath() + ") has the same checksum("
+ fromCheckSum + ") as the file to copy to (" + toFile.getAbsolutePath()
+ "). Skipping copy.");
}
return;
}
}