realpath

realpath(path::AbstractString) -> AbstractString

Canonicalize a path by expanding symbolic links and removing "." and ".." entries.

Examples

julia> realpath("mydir/../myfile.txt")
"/home/user/myfile.txt"

This example demonstrates how the realpath function can be used to obtain the canonicalized path by expanding symbolic links and resolving . and .. entries. In this case, the original path "mydir/../myfile.txt" is resolved to "/home/user/myfile.txt".

Common mistake example:

julia> realpath("nonexistent-file.txt")
ERROR: SystemError: realpath: no such file or directory (ENOENT)

In this example, the realpath function throws an error because the provided path refers to a non-existent file. Make sure to provide a valid path that exists in the file system when using realpath.

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: