This bug occurs because the Apache Commons IO .copyDirectory method doesn't copy file-level permissions when it copies a file in a directory tree. Instead, it creates a new file and uses a nio Channel to write the data from the source to the destination. The newly-created destination file inherits its permissions from the parent directory, rather than from the source file.
Short of putting a ticket in to ask about this to the Apache Commons IO team, the only solution is to write a directory walker that works as I would expect the copier to work.
This bug occurs because the Apache Commons IO
.copyDirectory
method doesn't copy file-level permissions when it copies a file in a directory tree. Instead, it creates a new file and uses a nio Channel to write the data from the source to the destination. The newly-created destination file inherits its permissions from the parent directory, rather than from the source file.Short of putting a ticket in to ask about this to the Apache Commons IO team, the only solution is to write a directory walker that works as I would expect the copier to work.