os.Path.rwx

Returns the UNIX™ file permissions of a file.

Syntax

os.Path.rwx(
   path STRING)
  RETURNS INTEGER
  1. path is the path to a file or directory.

Usage

This function returns the combination of permissions for user, group and other.

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.