I am trying to copy files with the method Files.copy during a Batch. Each run it takes a different amount of time to copy the files. I use exactly the same 12 files every time. It varies from 30 seconds to 30 minutes. How is that possible?
public void copyFile(File sourceFile, File targetFile, CopyOption... options) throws IOException {
Files.copy(sourceFile.toPath(), targetFile.toPath(), options);
}
As options, I use StandardCopyOption.COPY_ATTRIBUTES.
I used to use the Code proposed at http://stackoverflow.com/questions/106770/standard-concise-way-to-copy-a-file-in-java but wanted to change it since I upgraded to Java 7.