Main Content

WindowsPermissions

Permissions of file, folder, or symbolic link in Windows

Since R2025a

Description

Use a WindowsPermissions object to view and edit the permissions of a file, folder, or symbolic link located on a Windows® system.

Creation

Create a WindowsPermissions object using the filePermissions function.

You can then view and edit individual permissions of the specified file, folder, or symbolic link by using the getPermissions and setPermissions functions, respectively.

Properties

expand all

This property is read-only.

Absolute path of the file, folder, or symbolic link, returned as a string scalar.

This property is read-only.

Type, returned as File, Folder, Symbolic Link, or None. Type is None if MATLAB® cannot resolve the path in AbsolutePath.

Readable permission, specified as a numeric or logical 1 (true) or 0 (false). A value of 1 indicates that the file, folder, or symbolic link is readable.

Writable permission, specified as a numeric or logical 1 (true) or 0 (false). A value of 1 indicates that the file, folder, or symbolic link is writable.

Object Functions

getPermissionsGet individual permissions
setPermissionsSet individual permissions

Examples

collapse all

View the permissions of a file on a Windows operating system.

perms = filePermissions("example.txt")
perms = 

          AbsolutePath        Type    Readable    Writable
    ______________________    ____    ________    ________

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

Tips

  • On Windows systems, you can view permissions information in a Properties window by right-clicking a file, folder, or symbolic link and selecting Properties. The Properties window shows permissions under the Security tab, not in the Attributes section of the General tab.

Version History

Introduced in R2025a