I am at the center of automation of a series of actions that we do a lot to get some time. This includes moving files and running multiple batches.
In this particular situation, I am trying to copy a file from one place to another. Everything works fine until I try to use the copy parameter ATOMIC_MOVE. This is my code:
private void copyToDropFolder(Datafile datafile, String company) throws IOException{ Path datafilePath = datafile.getDataPath(); String dropFolder = locations.getLocationFor("default"); Path dropPath = Paths.get(dropFolder, company.toUpperCase(),locations.getLocationFor("drop"), datafile.getFileName()); Files.copy(datafilePath, dropPath, StandardCopyOption.ATOMIC_MOVE); }
I checked and resolved the location of datafilePath and dropPath, they are both valid. I tried with two other standard copy options, and the program works fine. For ATOMIC_MOVE only, I get a UnsupportedOperationException. It is not that I absolutely need this particular option, but I am curious why I will not work. I can not find other reports on this issue. I am doing this on a windows 7 machine.
Am I missing something? Or is ATOMIC_MOVE simply not supported?
source share