Skip to contents

Does the input contain a symbolic link?

Usage

isSymlink(x)

isASymlink(x, nullOk = FALSE)

allAreSymlinks(x)

Arguments

x

Object.

nullOk

logical(1). If set to TRUE, x may also be NULL.

Value

TRUE on success; FALSE on failure, with cause set.

Details

Supported on Linux and macOS but not Windows.

Functions

  • isSymlink(): Vectorized.

  • isASymlink(): Scalar.

  • allAreSymlinks(): Scalar.

Note

Updated 2023-10-02.

Examples

if (!isWindows()) {
    from <- "from.txt"
    to <- "to.txt"
    file.create(from)
    file.symlink(from = from, to = to)
    isSymlink(c(from, to))
    unlink(c(from, to))
}