Main Content

getPermissions

Get individual permissions

Since R2025a

Description

getPermissions(perms) displays the names, types, and permissions of the files, folders, and symbolic links in the specified permissions object.

example

getPermissions(perms,propName) displays the value of the specified property. You can specify one or more property names.

example

T = getPermissions(___) returns a table of the queried permissions and properties. You can specify an output argument with any of the previous syntaxes.

example

Examples

collapse all

Suppose that perms is a WindowsPermissions object that represents two local files. Display their names, types, and permissions.

getPermissions(perms)
          AbsolutePath         Type    Readable    Writable
    ______________________     ____    ________    ________

    "C:\Work\example1.txt"     File      true        true  
    "C:\Work\example2.txt"     File      true        false  

Display the name, type, and permissions for just the first file.

getPermissions(perms(1))
          AbsolutePath         Type    Readable    Writable
    ______________________     ____    ________    ________

    "C:\Work\example1.txt"     File      true        true 

Suppose that perms is a WindowsPermissions object that represents two files. Display the values of the Readable and Writable properties.

getPermissions(perms,["Readable","Writable"])
    Readable    Writable
    ________    ________

     true        true   
     true        false  

Now, return those property values as a table.

T = getPermissions(perms,["Readable","Writable"])
T = 2x2 table

    Readable    Writable
    ________    ________

     true        true   
     true        false  

Input Arguments

collapse all

Permissions to query, specified as a WindowsPermissions, UnixPermissions, CloudPermissions, or FileSystemEntryPermissions object.

Name of the property to query, specified as a string array, character vector, or cell array of character vectors.

Output Arguments

collapse all

Queried permissions information, returned as a table. The table variable names are the queried property names, and the table data represents those property values.

Data Types: table

Version History

Introduced in R2025a