os.Path.rwx

The os.Path.rwx method is used to return the UNIX file permissions of a file. The syntax of the function is as follows:

CALL os.Path.rwx(f_name) RETURNING mode

 

where:

·         f_name = a string variable standing for the file name,

·         mode = an integer standing for the combination of permissions for user, group or other.

 

Usage

The combination of permissions is always returned as a decimal value.

For example, if a file has the -rw--r--r permissions, you will get ((4+2) * 64 + 4 * 8 + 4) = 420

In case of a failure the function returns the negative integer (-1).

The 'mode' always gets a decimal value.