isblockdev
isblockdev(path) -> Bool
Returns true
if path
is a block device, false
otherwise.
Examples
-
Check if a path is a block device:
julia> isblockdev("/dev/sda") true
This example checks if the path
"/dev/sda"
is a block device. -
Handle non-block device path:
julia> isblockdev("/dev/null") false
It returns
false
for a non-block device path like"/dev/null"
. - Use with a variable:
julia> path = "/dev/sda"; julia> isblockdev(path) true
The function can also be used with a variable containing the path.
Common mistake example:
julia> isblockdev("/path/to/nonexistent")
ERROR: IOError: could not determine type of file "/path/to/nonexistent"
In this example, the function throws an IOError
because the provided path does not exist. Make sure to provide a valid path to avoid such errors.
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.