uperm
.. uperm(file)
Gets the permissions of the owner of the file as a bitfield of
==== =====================
01 Execute Permission
02 Write Permission
04 Read Permission
==== =====================
For allowed arguments, see ``stat``.Examples
In the Julia programming language, the function uperm(file) is not a built-in function. However, I can provide an example of how you can retrieve the permissions of a file using the FileStat type from the Base module.
julia> using Base
julia> function uperm(file)
stat = stat(file)
perm = stat.mode & 0o777
return perm
end
uperm (generic function with 1 method)
julia> file = "path/to/file.txt"
julia> uperm(file)
0o644
This example demonstrates a custom uperm function that takes a file path as an argument. It uses the stat function from the Base module to obtain the FileStat object for the given file. Then, it extracts the permissions as a bitfield by performing a bitwise AND operation (&) with the octal value 0o777. Finally, it returns the permissions.
Note: The example assumes that the file exists and the user has appropriate permissions to access 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.