os.Path.chrwx

The os.Path.chrwx method is used to change the UNIX permissions of the specified file. The syntax of the function is as follows:

CALL os.Path.chrwx(f_name, mode) RETURNING result

 

where:

·         f_name = a string containing the file name,

·         mode = an integer variable standing for the UNIX permission combination in decimal (not octal!),

·         result = TRUE ifsuccess or FALSE in case of a failure.

 

Usage

The mode stands for the combination of read (r), write (w) and execution (x) bits for the owner, group and other part of the UNIX file permission. Only the decimal value must be used there!

For example, in order to have -rwx-rw-r- permissions set, you must pass to this method ( ((4+2+1) *64) + ((4+2) * 8) + 4) = 500

 

Though the chmod UNIX command takes an octal value as a parameter, the 'mode' must take a decimal one.