Is there any mechanism to get and set the file/directory permissions?
For example, I want to show the permisssions of a file in a shell way:
-rwxr-xr--
Is it possible to do this using Java?
- I know that there are some methods in the
File
class to know if the filecanExecute
,canRead
andcanWrite
, but AFAIK this info is for the current user only. I need to know the whole octal number, for example 755, so I need to get it from the user, from group and from others. - I know that Java7 brings Posix operations, but how could do this using a smaller JRE?
- I would like not to use a command like
ls
, orchmod
.