On Windows, when using the [email protected]
class FileUtils
to copy a directory (e.g. FileUtils.copyDirectory(...)
, the behavior differs from that of Windows default copy behavior, quoting (microsoft.com):
"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."
Expected behavior:
- Files copied to destination inherit parent permissions
Actual behavior:
- Files copied to destination do NOT inherit parent permissions
The reason this is important is that Windows historically manages these; setting them manually would be prone to even more potential errors. Thus, without the ability to inherit target permissions, this method does not serve the most common-use purpose on Windows.
How do I restore the old behavior of inheriting the target permissions without downgrading the commons-io
library?
This seems to be a regression in behavior:
Version | Status |
---|---|
[email protected] |
✅ Inherits permissions of destination |
[email protected] |
|