Main Content

filePermissions

View and edit file, folder, and symbolic link permissions

Since R2025a

    Description

    perms = filePermissions(name) creates a permissions object that allows you to view and edit file, folder, and symbolic link permissions.

    Using the returned permissions object, you can view and edit individual permissions for the input file, folder, or symbolic link using the getPermissions and setPermissions functions, respectively.

    Examples

    collapse all

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

    perms = filePermissions("windowsExample.txt")
    perms = 
    
                  AbsolutePath           Type    Readable    Writable
        _____________________________    ____    ________    ________
    
        "C:\Work\windowsExample.txt"     File      true        true  

    View the permissions of a file on a UNIX® operating system.

    perms = filePermissions("unixExample.txt")
    perms = 
    
               AbsolutePath           Type     Readable    Writable    UserExecute    GroupRead    GroupWrite    GroupExecute    OtherRead    OtherWrite    OtherExecute  
        _________________________     ____     ________    ________    ___________    _________    __________    ____________    _________    __________    ____________
    
        "/home/unixExample.txt"       File       true        true         true          true          true           true          true          true           true

    View the permissions of a file in a remote location.

    perms = filePermissions("s3://bucket/file")
    perms = 
    
           AbsolutePath       Type    Readable    Writable
        __________________    ____    ________    ________
    
        "s3://bucket/file"    File      true        true  

    Input Arguments

    collapse all

    File, folder, or symbolic link name, specified as a string array, character vector, or cell array of character vectors. This function supports Windows, UNIX, and cloud file systems.

    Example: "C:\..\myfolder\subfolder"

    Example: ["example1.txt","example2.txt"]

    Output Arguments

    collapse all

    Permissions object, returned as a WindowsPermissions, UnixPermissions, CloudPermissions, or FileSystemEntryPermissions object. The returned permissions object is determined by the system where the file, folder, or symbolic link resides or is hosted. The function creates a FileSystemEntryPermissions object if you specify input files from different file systems (Windows, UNIX, or cloud).

    Using the returned permissions object, you can view and edit individual permissions for the input file, folder, or symbolic link using the getPermissions and setPermissions functions, respectively.

    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