I have a zip file that gets created at runtime that I need to copy to another directory however whenever I run my code I get a DirectoryNotEmptyException
. Is there some extra parameter I need to specify to copy into a non-empty directory?
Here's the layout
Path sourceZip = new File(path).toPath();
String destinDir = new File(System.getProperty("user.dir")).getParent();
Path target = Paths.get(destinDir);
try {
Files.copy(sourceZip, target, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) //DirectoryNotEmptyException occurs here
{}