Main Content

FileSystemEntryPermissions

Permissions of files, folders, or symbolic links on different systems

Since R2025a

Description

Use a FileSystemEntryPermissions object to view and edit the permissions of files or folders located on different systems. This object also supports symbolic links on Windows® or UNIX® systems.

Creation

Create a FileSystemEntryPermissions object using the filePermissions function. The properties of a FileSystemEntryPermissions object are dependent on the locations of the specified files, folders, or symbolic links.

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.

This property is read-only for files and folders in cloud locations.

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.

This property is read-only for files and folders in cloud locations.

Object Functions

getPermissionsGet individual permissions
setPermissionsSet individual permissions

Examples

collapse all

View the permissions of files located on different file systems.

windowsLocation = "C:\Work\example.txt"
cloudLocation = "s3://bucket/file"
perms = filePermissions([windowsLocation,cloudLocation])
perms = 

          AbsolutePath        Type    Readable    Writable
    ______________________    ____    ________    ________

    "C:\Work\example.txt"     File      true        true  
    "s3://bucket/file"        File      true        true  

Version History

Introduced in R2025a