This post is more than 2 years old.
So I don't know if this is the best answer, but it's what I was able to glean from Google this morning. Java 6 does have some functions that can tell you if the current application can read, write, and execute a file. (See the File doc.) But as far as I can tell, this only applies to the user that the application is running as.
I am using Linux(Railo) as my server and I want to show the files permission(mode) in a directory as -rwxr-xr-x (eq.). How can I show this?
We can set file permission using FileSetAccessMode() but how to get this permission like "-rwxr-xr-x" this to show in a page ?
I found more than a few search results though that mentioned using a system specific command. In ColdFusion that means cfexecute. Consider this sample:
<cfexecute name="ls" arguments="-l /Users/ray/lhp.txt" variable="result" timeout="99" />
-rw-r--r-- 1 ray ray 6386 May 12 2007 /Users/ray/lhp.txt
This is simple enough to parse with a string function:
By treating the result as a list, I can then end up with just the permissions. Obviously this won't run on Windows, but you get the idea.