os.Path.chrwx

Changes the UNIX™ permissions of a file.

Syntax

os.Path.chrwx(
   fname STRING,
   mode INTEGER )
  RETURNING result INTEGER
  1. fname is the name of the file.
  2. mode is the UNIX permission combination in decimal (not octal!).

Usage

This method can only be used on UNIX!

Function returns TRUE on success, FALSE otherwise.

The mode must be a decimal value which is the combination of read, write and execution bits for the user, group and other part of the UNIX file permission. Make sure to pass the mode as the decimal version of permissions, not as octal (the chrwx UNIX command takes an octal value as parameter). For example, to set -rw-r--r-- permissions, you must pass ( ((4+2) *64) + (4 * 8) + 4 ) = 420 to this method.