Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

linux file permissions

 
Eric Fox
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic