Main Content

isSymbolicLink

Determine if input is symbolic link

Since R2024b

    Description

    tf = isSymbolicLink(link) returns 1 if link is a symbolic link. Otherwise, isSymbolicLink returns 0.

    On Windows® operating systems, you must start MATLAB® with the Run as administrator option to work with symbolic links. To start MATLAB with this option, right-click the MATLAB icon and select Run as administrator. If that option is not available, contact your system administrator.

    example

    [tf,target] = isSymbolicLink(link) also returns the absolute path of the symbolic link target.

    example

    Examples

    collapse all

    Determine if the symbolic link ExampleLink exists. The result of 1 indicates that ExampleLink is a symbolic link.

    tf = isSymbolicLink("ExampleLink")
    tf =
     
      logical
     
       1

    Determine if the symbolic link ExampleLink exists and what its target is.

    [tf,target] = isSymbolicLink("ExampleLink")
    tf =
     
      logical
     
       1
    
    target = 
    
        'C:\Work\ExampleFolder'

    Input Arguments

    collapse all

    Symbolic link, specified as a string array, character vector, or cell array of character vectors.

    Output Arguments

    collapse all

    True or false result, returned as a 1 or 0 of data type logical.

    Symbolic link target, returned as a character vector that contains an absolute file or folder path, or a missing value. target is a missing value if the symbolic link or its target does not exist.

    Version History

    Introduced in R2024b