permaculture playing cards*
The moose likes Java in General and the fly likes linux file permissions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "linux file permissions" Watch "linux file permissions" New topic
Author

linux file permissions

Eric Fox
Greenhorn

Joined: Nov 24, 2003
Posts: 3
This maybe a stupid question, but I am creating a program and I need to know the linux file permissions of a file object. Is there a method or set of methods that can be used to get the read, write, and execution permissions for the owner, group, and everyone else?
mike foo
Greenhorn

Joined: Nov 22, 2003
Posts: 9
Originally posted by Eric Fox:
This maybe a stupid question, but I am creating a program and I need to know the linux file permissions of a file object. Is there a method or set of methods that can be used to get the read, write, and execution permissions for the owner, group, and everyone else?

I am not aware of such a thing.You can figure out file permission with ls command.You could try using java's Runtime.getRuntime().exec(cmd) ;method to run the command. It probably did not help but ...
Alastair Rae
Greenhorn

Joined: Nov 14, 2003
Posts: 7
I think you will have to use JNI to get the permissions in C.
Why Sun couldn't have come up with some generic model of permissions is beyond me. Or even just a *nix version.
Eric Fox
Greenhorn

Joined: Nov 24, 2003
Posts: 3
I figure that I will just use the exec command on ls and get the string of file permissions from the output. It is a round about way but it should work. Thanks for your replies, they helped me to come to this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: linux file permissions