Hello Tres, I think what you want is to call FileUtils.copyDirectory() or PathUtils.copyDirectory() with java.nio.file.StandardCopyOption.COPY_ATTRIBUTES.
Gary On Sat, Aug 20, 2022 at 2:51 PM Tres Finocchiaro <tres.finocchi...@gmail.com> wrote: > > > > Use *org.apache.commons.io.FileUtils.copyFile(File, File, boolean, > > CopyOption...)* to exercise full control over what you want to do. > > > > Thanks for the reply. > > From my understanding, CopyOption supports one or more of three > options: REPLACE_EXISTING, COPY_ATTRIBUTES, NOFOLLOW_LINKS, none of which > help with the aforementioned question. Do you agree? > > The behavior of Windows is to preserve the destination permissions, per > Microsoft: > > "By default, an object inherits permissions from its parent object, either > > at the time of creation or when it is copied or moved to its parent > folder. > > The only exception to this rule occurs when you move an object to a > > different folder on the same volume. In this case, the original > permissions > > are retained." > > > So, the default copy behavior is not useful on Windows except > edge-cases where people are looking to preserve permissions, which is > non-standard and should not be default. > > Under the covers it ends up calling *java.nio.file.Files.copy(Path, Path, > > CopyOption...)*. > > > I'm happy to try a workaround that uses CopyOption to remedy this, but I'm > not really sure where to start since the above options don't look like > they'll help. >