Bom dia!
Uso o seguinte método para fazer cópias de arquivos.
private static void copyFile(File source, File destination) throws IOException {
if (destination.exists()) {
destination.delete();
}
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sourceChannel = new FileInputStream(source).getChannel();
destinationChannel = new FileOutputStream(destination).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(),
destinationChannel);
} finally {
if (sourceChannel != null && sourceChannel.isOpen()) {
sourceChannel.close();
}
if (destinationChannel != null && destinationChannel.isOpen()) {
destinationChannel.close();
}
}
}
Só que assim que ele faz a cópia, o arquivo fica com a data de criação igual a data que acabou de copiar.
Gostaria de saber como fazer para manipular a data de criação desse arquivo em java.