[ 
https://issues.apache.org/jira/browse/IO-575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16404654#comment-16404654
 ] 

Adam Kewley commented on IO-575:
--------------------------------

Ok, thanks for clarifying - I thought as much, but wanted to bring it to the 
dev's attention.

I need the feature in my software because it executes arbitrary files at 
runtime so, in my case, I implemented a `FileVisitor`, almost exactly as 
Oracle's example:

[https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileVisitor.html]

(again, just in case other devs need it)

> copyDirectory (all overloads) does not maintain file permissions
> ----------------------------------------------------------------
>
>                 Key: IO-575
>                 URL: https://issues.apache.org/jira/browse/IO-575
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 2.5
>            Reporter: Adam Kewley
>            Priority: Minor
>
> I found that permissions (specifically, execute) are not maintained when 
> using copyDirectory. The following test demonstrates the behavior:**
>  
> {code:java}
> Path sourceDir = Files.createTempDirectory("source-dir");
> String filename = "some-file";
> Path sourceFile = Files.createFile(sourceDir.resolve(filename));
> assertThat(sourceFile.toFile().canExecute()).isFalse();
> sourceFile.toFile().setExecutable(true);
> assertThat(sourceFile.toFile().canExecute()).isTrue();
> Path destDir = Files.createTempDirectory("some-empty-destination");
> FileUtils.copyDirectory(sourceDir.toFile(), destDir.toFile());
> Path destFile = destDir.resolve(filename);
> assertThat(destFile.toFile().exists()).isTrue();
> assertThat(destFile.toFile().canExecute()).isTrue(); // fails
> {code}
> Is it working as intended that the permissions are not copied over?
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to