os.Path.rwx

Returns the UNIX™ file permissions of a file.

Syntax

os.Path.rwx(
   fname STRING)
  RETURNING mode INTEGER
  1. fname is the name of the file.
  2. mode is the combination of permissions for user, group and other.

Usage

This method can only be used on UNIX!

Function returns -1 if it fails to get the permissions.

The mode is returned as 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. For example, if a file has the -rwxr-xr-x permissions, the method returns ((4+2+1) * 64 + (4+1) * 8) + (4+1) ) = 493.