lstat

lstat(file)

Like stat, but for symbolic links gets the info for the link itself rather than the file it refers to. This function must be called on a file path rather than a file object or a file descriptor.

Examples

In the Julia programming language, the function lstat(file) is used to retrieve information about a symbolic link itself, rather than the file it refers to. It is important to note that this function must be called on a file path, not a file object or file descriptor.

Here are some examples of how to use the lstat function:

  1. Get information about a symbolic link:

    julia> lstat("path/to/symlink")
    FileInfo("path/to/symlink", true, false, false, false, false, false, false)

    This example retrieves information about the symbolic link located at "path/to/symlink".

  2. Check if a file path is a symbolic link:

    julia> info = lstat("path/to/file")
    julia> islink(info)
    false

    In this example, the lstat function is used to get information about the file located at "path/to/file". The islink function is then used to check if it is a symbolic link.

  3. Handle errors when file path is invalid:
    julia> info = lstat("nonexistent/file")
    ERROR: SystemError: stat: no such file or directory (ENOENT)

    If the file path provided to lstat does not exist, an error will be thrown. It's important to handle such cases appropriately.

Please note that the examples given assume that the FileInfo type is used to represent the information returned by lstat. The specific fields and format of the returned information may vary depending on the platform and file system being used.

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: