symlink

symlink(target, link)

Creates a symbolic link to target with the name link.

note

This function raises an error under operating systems that do not support soft symbolic links, such as Windows XP.

Examples

  1. Create a symbolic link:

    julia> symlink("path/to/target", "path/to/link")
    "path/to/link"

    This example creates a symbolic link named "link" that points to the target path "path/to/target".

  2. Use a relative path for the target:
    julia> symlink("../target/file.txt", "link/file.txt")
    "link/file.txt"

    The target path can be specified using a relative path as well.

Common mistake example:

julia> symlink("nonexistent/file.txt", "link/file.txt")
ERROR: SystemError: symlink: no such file or directory (ENOENT)

In this example, the target file "nonexistent/file.txt" does not exist, causing an error. Make sure the target file or directory exists before creating a symbolic link to it.

See Also

abspath, basename, chmod, countlines, cp, ctime, dirname, download, evalfile, expanduser, fdio, filemode, filesize, functionloc, gperm, homedir, include_string, isabspath, isblockdev, ischardev, isdir, isdirpath, isexecutable, isfifo, isfile, islink, ismount, ispath, isreadable, issetgid, issetuid, issticky, iswritable, joinpath, less, lstat, mkdir, mkpath, mktemp, mktempdir, mtime, mv, normpath, operm, poll_fd, poll_file, readall, readcsv, readdir, readdlm, readlines, readlink, realpath, relpath, rm, splitdir, splitdrive, splitext, stat, symlink, tempdir, tempname, touch, truncate, uperm, watch_file, writecsv,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: