Should Files.createDirectory allow setting of group and other permissions?
Tim Fox
timvolpe at gmail.com
Fri Aug 5 05:23:25 PDT 2011
I am calling Files.createDirectory() to create a new directory with a
set of Posix file permissions, on Linux. Here is some example code:
String perms = "rwxrwxrwx";
String dirName = "some-dir";
FileAttribute<?> attrs =
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(perms));
Files.createDirectory(Paths.get(dirName), attrs);
System.out.println(PosixFilePermissions.toString(Files.getPosixFilePermissions(Paths.get(dirName))));
Prints out "rwxr-xr-x", not "rwxrwxrwx"
If I change perms to "r-xrwxrwx" then it prints out "r-xr-xr-x"
I.e. it seems when creating dirs the group and other permissions are
ignored, and only the specified user permissions are set.
Can anyone clarify whether this is expected behaviour?
Thanks
More information about the nio-discuss
mailing list