Base.read —Methodread(filename::AbstractString)Read the entire contents of a file as aVector{UInt8}.
read(filename::AbstractString, String)Read the entire contents of a file as a string.
read(filename::AbstractString, args...)Open a file and read its contents.args is passed toread: this is equivalent toopen(io->read(io, args...), filename).
Base.write —Methodwrite(filename::AbstractString, content)Write the canonical binary representation ofcontent to a file, which will be created if it does not exist yet or overwritten if it does exist.
Return the number of bytes written into the file.
sourceBase.Filesystem.pwd —FunctionBase.Filesystem.cd —Methodcd(f::Function, dir::AbstractString=homedir())Temporarily change the current working directory todir, apply functionf and finally return to the original directory.
Examples
julia> pwd()"/home/JuliaUser"julia> cd(readdir, "/home/JuliaUser/Projects/julia")34-element Vector{String}: ".circleci" ".freebsdci.sh" ".git" ".gitattributes" ".github" ⋮ "test" "ui" "usr" "usr-staging"julia> pwd()"/home/JuliaUser"sourceBase.Filesystem.readdir —Functionreaddir(dir::AbstractString=pwd(); join::Bool = false, sort::Bool = true,) -> Vector{String}Return the names in the directorydir or the current working directory if not given. Whenjoin is false,readdir returns just the names in the directory as is; whenjoin is true, it returnsjoinpath(dir, name) for eachname so that the returned strings are full paths. If you want to get absolute paths back, callreaddir with an absolute directory path andjoin set to true.
By default,readdir sorts the list of names it returns. If you want to skip sorting the names and get them in the order that the file system lists them, you can usereaddir(dir, sort=false) to opt out of sorting.
See also:walkdir.
Examples
julia> cd("/home/JuliaUser/dev/julia")julia> readdir()30-element Vector{String}: ".appveyor.yml" ".git" ".gitattributes" ⋮ "ui" "usr" "usr-staging"julia> readdir(join=true)30-element Vector{String}: "/home/JuliaUser/dev/julia/.appveyor.yml" "/home/JuliaUser/dev/julia/.git" "/home/JuliaUser/dev/julia/.gitattributes" ⋮ "/home/JuliaUser/dev/julia/ui" "/home/JuliaUser/dev/julia/usr" "/home/JuliaUser/dev/julia/usr-staging"julia> readdir("base")145-element Vector{String}: ".gitignore" "Base.jl" "Enums.jl" ⋮ "version_git.sh" "views.jl" "weakkeydict.jl"julia> readdir("base", join=true)145-element Vector{String}: "base/.gitignore" "base/Base.jl" "base/Enums.jl" ⋮ "base/version_git.sh" "base/views.jl" "base/weakkeydict.jl"julia> readdir(abspath("base"), join=true)145-element Vector{String}: "/home/JuliaUser/dev/julia/base/.gitignore" "/home/JuliaUser/dev/julia/base/Base.jl" "/home/JuliaUser/dev/julia/base/Enums.jl" ⋮ "/home/JuliaUser/dev/julia/base/version_git.sh" "/home/JuliaUser/dev/julia/base/views.jl" "/home/JuliaUser/dev/julia/base/weakkeydict.jl"sourceBase.Filesystem.walkdir —Functionwalkdir(dir = pwd(); topdown=true, follow_symlinks=false, onerror=throw)Return an iterator that walks the directory tree of a directory.
The iterator returns a tuple containing(path, dirs, files). Each iterationpath will change to the next directory in the tree; thendirs andfiles will be vectors containing the directories and files in the currentpath directory. The directory tree can be traversed top-down or bottom-up. Ifwalkdir orstat encounters aIOError it will rethrow the error by default. A custom error handling function can be provided throughonerror keyword argument.onerror is called with aIOError as argument. The returned iterator is stateful so when accessed repeatedly each access will resume where the last left off, likeIterators.Stateful.
See also:readdir.
Examples
for (path, dirs, files) in walkdir(".") println("Directories in $path") for dir in dirs println(joinpath(path, dir)) # path to directories end println("Files in $path") for file in files println(joinpath(path, file)) # path to files endendjulia> mkpath("my/test/dir");julia> itr = walkdir("my");julia> (path, dirs, files) = first(itr)("my", ["test"], String[])julia> (path, dirs, files) = first(itr)("my/test", ["dir"], String[])julia> (path, dirs, files) = first(itr)("my/test/dir", String[], String[])sourceBase.Filesystem.mkdir —Functionmkdir(path::AbstractString; mode::Unsigned = 0o777)Make a new directory with namepath and permissionsmode.mode defaults to0o777, modified by the current file creation mask. This function never creates more than one directory. If the directory already exists, or some intermediate directories do not exist, this function throws an error. Seemkpath for a function which creates all required intermediate directories. Returnpath.
Examples
julia> mkdir("testingdir")"testingdir"julia> cd("testingdir")julia> pwd()"/home/JuliaUser/testingdir"sourceBase.Filesystem.mkpath —Functionmkpath(path::AbstractString; mode::Unsigned = 0o777)Create all intermediate directories in thepath as required. Directories are created with the permissionsmode which defaults to0o777 and is modified by the current file creation mask. Unlikemkdir,mkpath does not error ifpath (or parts of it) already exists. However, an error will be thrown ifpath (or parts of it) points to an existing file. Returnpath.
Ifpath includes a filename you will probably want to usemkpath(dirname(path)) to avoid creating a directory using the filename.
Examples
julia> cd(mktempdir())julia> mkpath("my/test/dir") # creates three directories"my/test/dir"julia> readdir()1-element Vector{String}: "my"julia> cd("my")julia> readdir()1-element Vector{String}: "test"julia> readdir("test")1-element Vector{String}: "dir"julia> mkpath("intermediate_dir/actually_a_directory.txt") # creates two directories"intermediate_dir/actually_a_directory.txt"julia> isdir("intermediate_dir/actually_a_directory.txt")truejulia> mkpath("my/test/dir/") # returns the original `path`"my/test/dir/"sourceBase.Filesystem.hardlink —FunctionBase.Filesystem.symlink —Functionsymlink(target::AbstractString, link::AbstractString; dir_target = false)Creates a symbolic link totarget with the namelink.
On Windows, symlinks must be explicitly declared as referring to a directory or not. Iftarget already exists, by default the type oflink will be auto- detected, however iftarget does not exist, this function defaults to creating a file symlink unlessdir_target is set totrue. Note that if the user setsdir_target buttarget exists and is a file, a directory symlink will still be created, but dereferencing the symlink will fail, just as if the user creates a file symlink (by callingsymlink() withdir_target set tofalse before the directory is created) and tries to dereference it to a directory.
Additionally, there are two methods of making a link on Windows; symbolic links and junction points. Junction points are slightly more efficient, but do not support relative paths, so if a relative directory symlink is requested (as denoted byisabspath(target) returningfalse) a symlink will be used, else a junction point will be used. Best practice for creating symlinks on Windows is to create them only after the files/directories they reference are already created.
See also:hardlink.
This function raises an error under operating systems that do not support soft symbolic links, such as Windows XP.
Thedir_target keyword argument was added in Julia 1.6. Prior to this, symlinks to nonexistent paths on windows would always be file symlinks, and relative symlinks to directories were not supported.
Base.Filesystem.readlink —Functionreadlink(path::AbstractString) -> StringReturn the target location a symbolic linkpath points to.
Base.Filesystem.chmod —Functionchmod(path::AbstractString, mode::Integer; recursive::Bool=false)Change the permissions mode ofpath tomode. Only integermodes (e.g.0o777) are currently supported. Ifrecursive=true and the path is a directory all permissions in that directory will be recursively changed. Returnpath.
Prior to Julia 1.6, this did not correctly manipulate filesystem ACLs on Windows, therefore it would only set read-only bits on files. It now is able to manipulate ACLs.
Base.Filesystem.chown —Functionchown(path::AbstractString, owner::Integer, group::Integer=-1)Change the owner and/or group ofpath toowner and/orgroup. If the value entered forowner orgroup is-1 the corresponding ID will not change. Only integerowners andgroups are currently supported. Returnpath.
Base.Libc.RawFD —TypeBase.stat —Functionstat(path)stat(path_elements...)Return a structure whose fields contain information about the file. If multiple arguments are given, they are joined byjoinpath.
The fields of the structure are:
| Name | Type | Description |
|---|---|---|
| desc | Union{String, Base.OS_HANDLE} | The path or OS file descriptor |
| size | Int64 | The size (in bytes) of the file |
| device | UInt | ID of the device that contains the file |
| inode | UInt | The inode number of the file |
| mode | UInt | The protection mode of the file |
| nlink | Int | The number of hard links to the file |
| uid | UInt | The user id of the owner of the file |
| gid | UInt | The group id of the file owner |
| rdev | UInt | If this file refers to a device, the ID of the device it refers to |
| blksize | Int64 | The file-system preferred block size for the file |
| blocks | Int64 | The number of 512-byte blocks allocated |
| mtime | Float64 | Unix timestamp of when the file was last modified |
| ctime | Float64 | Unix timestamp of when the file's metadata was changed |
Base.Filesystem.diskstat —Functiondiskstat(path=pwd())Returns statistics in bytes about the disk that contains the file or directory pointed at bypath. If no argument is passed, statistics about the disk that contains the current working directory are returned.
Base.Filesystem.lstat —FunctionBase.Filesystem.ctime —Functionctime(path)ctime(path_elements...)ctime(stat_struct)Return the unix timestamp of when the metadata of the file atpath was last modified, or the last modified metadata timestamp indicated by the file descriptorstat_struct.
Equivalent tostat(path).ctime orstat_struct.ctime.
Base.Filesystem.mtime —Functionmtime(path)mtime(path_elements...)mtime(stat_struct)Return the unix timestamp of when the file atpath was last modified, or the last modified timestamp indicated by the file descriptorstat_struct.
Equivalent tostat(path).mtime orstat_struct.mtime.
Base.Filesystem.filemode —Functionfilemode(path)filemode(path_elements...)filemode(stat_struct)Return the mode of the file located atpath, or the mode indicated by the file descriptorstat_struct.
Equivalent tostat(path).mode orstat_struct.mode.
Base.filesize —Functionfilesize(path)filesize(path_elements...)filesize(stat_struct)Return the size of the file located atpath, or the size indicated by file descriptorstat_struct.
Equivalent tostat(path).size orstat_struct.size.
Base.Filesystem.uperm —Functionuperm(path)uperm(path_elements...)uperm(stat_struct)Return a bitfield of the owner permissions for the file atpath or file descriptorstat_struct.
| Value | Description |
|---|---|
| 01 | Execute Permission |
| 02 | Write Permission |
| 04 | Read Permission |
The fact that a bitfield is returned means that if the permission is read+write, the bitfield is "110", which maps to the decimal value of 0+2+4=6. This is reflected in the printing of the returnedUInt8 value.
julia> touch("dummy_file"); # Create test-file without contentsjulia> uperm("dummy_file")0x06julia> bitstring(ans)"00000110"julia> has_read_permission(path) = uperm(path) & 0b00000100 != 0; # Use bit mask to check specific bitjulia> has_read_permission("dummy_file")truejulia> rm("dummy_file") # Clean up test-filesourceBase.Filesystem.gperm —FunctionBase.Filesystem.operm —FunctionBase.Filesystem.cp —Functioncp(src::AbstractString, dst::AbstractString; force::Bool=false, follow_symlinks::Bool=false)Copy the file, link, or directory fromsrc todst.force=true will first remove an existingdst.
Iffollow_symlinks=false, andsrc is a symbolic link,dst will be created as a symbolic link. Iffollow_symlinks=true andsrc is a symbolic link,dst will be a copy of the file or directorysrc refers to. Returndst.
Thecp function is different from thecp Unix command. Thecp function always operates on the assumption thatdst is a file, while the command does different things depending on whetherdst is a directory or a file. Usingforce=true whendst is a directory will result in loss of all the contents present in thedst directory, anddst will become a file that has the contents ofsrc instead.
Base.download —Functiondownload(url::AbstractString, [path::AbstractString = tempname()]) -> pathDownload a file from the given url, saving it to the locationpath, or if not specified, a temporary path. Returns the path of the downloaded file.
Since Julia 1.6, this function is deprecated and is just a thin wrapper aroundDownloads.download. In new code, you should use that function directly instead of calling this.
Base.Filesystem.mv —Functionmv(src::AbstractString, dst::AbstractString; force::Bool=false)Move the file, link, or directory fromsrc todst.force=true will first remove an existingdst. Returndst.
Examples
julia> write("hello.txt", "world");julia> mv("hello.txt", "goodbye.txt")"goodbye.txt"julia> "hello.txt" in readdir()falsejulia> readline("goodbye.txt")"world"julia> write("hello.txt", "world2");julia> mv("hello.txt", "goodbye.txt")ERROR: ArgumentError: 'goodbye.txt' exists. `force=true` is required to remove 'goodbye.txt' before moving.Stacktrace: [1] #checkfor_mv_cp_cptree#10(::Bool, ::Function, ::String, ::String, ::String) at ./file.jl:293[...]julia> mv("hello.txt", "goodbye.txt", force=true)"goodbye.txt"julia> rm("goodbye.txt");Themv function is different from themv Unix command. Themv function by default will error ifdst exists, while the command will delete an existingdst file by default. Also themv function always operates on the assumption thatdst is a file, while the command does different things depending on whetherdst is a directory or a file. Usingforce=true whendst is a directory will result in loss of all the contents present in thedst directory, anddst will become a file that has the contents ofsrc instead.
Base.Filesystem.rename —FunctionBase.rename(oldpath::AbstractString, newpath::AbstractString)Change the name of a file or directory fromoldpath tonewpath. Ifnewpath is an existing file or empty directory it may be replaced. Equivalent torename(2) on Unix. If a path contains a "\0" throw anArgumentError. On other failures throw anIOError. Returnnewpath.
This is a lower level filesystem operation used to implementmv.
OS-specific restrictions may apply whenoldpath andnewpath are in different directories.
Currently there are a few differences in behavior on Windows which may be resolved in a future release. Specifically, currently on Windows:
rename will fail ifoldpath ornewpath are opened files.rename will fail ifnewpath is an existing directory.rename may work ifnewpath is a file andoldpath is a directory.rename may removeoldpath if it is a hardlink tonewpath.See also:mv.
Base.Filesystem.rm —Functionrm(path::AbstractString; force::Bool=false, recursive::Bool=false)Delete the file, link, or empty directory at the given path. Ifforce=true is passed, a non-existing path is not treated as error. Ifrecursive=true is passed and the path is a directory, then all contents are removed recursively.
Examples
julia> mkpath("my/test/dir");julia> rm("my", recursive=true)julia> rm("this_file_does_not_exist", force=true)julia> rm("this_file_does_not_exist")ERROR: IOError: unlink("this_file_does_not_exist"): no such file or directory (ENOENT)Stacktrace:[...]sourceBase.Filesystem.touch —FunctionBase.touch(::Pidfile.LockMonitor)Update themtime on the lock, to indicate it is still fresh.
See also therefresh keyword in themkpidlock constructor.
touch(path::AbstractString)touch(fd::File)Update the last-modified timestamp on a file to the current time.
If the file does not exist a new file is created.
Returnpath.
Examples
julia> write("my_little_file", 2);julia> mtime("my_little_file")1.5273815391135583e9julia> touch("my_little_file");julia> mtime("my_little_file")1.527381559163435e9We can see themtime has been modified bytouch.
Base.Filesystem.tempname —Functiontempname(parent=tempdir(); cleanup=true, suffix="") -> StringGenerate a temporary file path. This function only returns a path; no file is created. The path is likely to be unique, but this cannot be guaranteed due to the very remote possibility of two simultaneous calls totempname generating the same file name. The name is guaranteed to differ from all files already existing at the time of the call totempname.
When called with no arguments, the temporary name will be an absolute path to a temporary name in the system temporary directory as given bytempdir(). If aparent directory argument is given, the temporary path will be in that directory instead. If a suffix is given the tempname will end with that suffix and be tested for uniqueness with that suffix.
Thecleanup option controls whether the process attempts to delete the returned path automatically when the process exits. Note that thetempname function does not create any file or directory at the returned location, so there is nothing to cleanup unless you create a file or directory there. If you do andcleanup istrue it will be deleted upon process termination.
Theparent andcleanup arguments were added in 1.4. Prior to Julia 1.4 the pathtempname would never be cleaned up at process termination.
This can lead to security holes if another process obtains the same file name and creates the file before you are able to. Open the file withJL_O_EXCL if this is a concern. Usingmktemp() is also recommended instead.
Base.Filesystem.tempdir —Functiontempdir()Gets the path of the temporary directory. On Windows,tempdir() uses the first environment variable found in the ordered listTMP,TEMP,USERPROFILE. On all other operating systems,tempdir() uses the first environment variable found in the ordered listTMPDIR,TMP,TEMP, andTEMPDIR. If none of these are found, the path"/tmp" is used.
Base.Filesystem.mktemp —Methodmktemp(parent=tempdir(); cleanup=true) -> (path, io)Return(path, io), wherepath is the path of a new temporary file inparent andio is an open file object for this path. Thecleanup option controls whether the temporary file is automatically deleted when the process exits.
Thecleanup keyword argument was added in Julia 1.3. Relatedly, starting from 1.3, Julia will remove the temporary paths created bymktemp when the Julia process exits, unlesscleanup is explicitly set tofalse.
Base.Filesystem.mktemp —Methodmktemp(f::Function, parent=tempdir())Apply the functionf to the result ofmktemp(parent) and remove the temporary file upon completion.
See also:mktempdir.
Base.Filesystem.mktempdir —Methodmktempdir(parent=tempdir(); prefix="jl_", cleanup=true) -> pathCreate a temporary directory in theparent directory with a name constructed from the givenprefix and a random suffix, and return its path. Additionally, on some platforms, any trailing'X' characters inprefix may be replaced with random characters. Ifparent does not exist, throw an error. Thecleanup option controls whether the temporary directory is automatically deleted when the process exits.
Thecleanup keyword argument was added in Julia 1.3. Relatedly, starting from 1.3, Julia will remove the temporary paths created bymktempdir when the Julia process exits, unlesscleanup is explicitly set tofalse.
Base.Filesystem.mktempdir —Methodmktempdir(f::Function, parent=tempdir(); prefix="jl_")Apply the functionf to the result ofmktempdir(parent; prefix) and remove the temporary directory and all of its contents upon completion.
Base.Filesystem.isblockdev —Functionisblockdev(path) -> Boolisblockdev(path_elements...) -> Boolisblockdev(stat_struct) -> BoolReturntrue if the pathpath or file descriptorstat_struct refer to a block device,false otherwise.
Base.Filesystem.ischardev —Functionischardev(path) -> Boolischardev(path_elements...) -> Boolischardev(stat_struct) -> BoolReturntrue if the pathpath or file descriptorstat_struct refer to a character device,false otherwise.
Base.Filesystem.isdir —FunctionBase.Filesystem.isfifo —Functionisfifo(path) -> Boolisfifo(path_elements...) -> Boolisfifo(stat_struct) -> BoolReturntrue if the file atpath or file descriptorstat_struct is FIFO,false otherwise.
Base.Filesystem.isfile —Functionisfile(path) -> Boolisfile(path_elements...) -> BoolReturntrue ifpath points to a regular file,false otherwise.
Examples
julia> isfile(homedir())falsejulia> filename = "test_file.txt";julia> write(filename, "Hello world!");julia> isfile(filename)truejulia> rm(filename);julia> isfile(filename)falsesourceBase.Filesystem.islink —Functionislink(path) -> Boolislink(path_elements...) -> BoolReturntrue ifpath points to a symbolic link,false otherwise.
Base.Filesystem.ismount —Functionismount(path) -> Boolismount(path_elements...) -> BoolReturntrue ifpath is a mount point,false otherwise.
Base.Filesystem.ispath —FunctionBase.Filesystem.issetgid —Functionissetgid(path) -> Boolissetgid(path_elements...) -> Boolissetgid(stat_struct) -> BoolReturntrue if the file atpath or file descriptorstat_struct have the setgid flag set,false otherwise.
Base.Filesystem.issetuid —Functionissetuid(path) -> Boolissetuid(path_elements...) -> Boolissetuid(stat_struct) -> BoolReturntrue if the file atpath or file descriptorstat_struct have the setuid flag set,false otherwise.
Base.Filesystem.issocket —Functionissocket(path) -> Boolissocket(path_elements...) -> BoolReturntrue ifpath points to a socket,false otherwise.
Base.Filesystem.issticky —Functionissticky(path) -> Boolissticky(path_elements...) -> Boolissticky(stat_struct) -> BoolReturntrue if the file atpath or file descriptorstat_struct have the sticky bit set,false otherwise.
Base.Filesystem.homedir —Functionhomedir() -> StringReturn the current user's home directory.
homedir determines the home directory vialibuv'suv_os_homedir. For details (for example on how to specify the home directory via environment variables), see theuv_os_homedir documentation.
See alsoSys.username.
Base.Filesystem.dirname —FunctionBase.Filesystem.basename —Functionbasename(path::AbstractString) -> StringGet the file name part of a path.
This function differs slightly from the Unixbasename program, where trailing slashes are ignored, i.e.$ basename /foo/bar/ returnsbar, whereasbasename in Julia returns an empty string"".
Examples
julia> basename("/home/myuser/example.jl")"example.jl"julia> basename("/home/myuser/")""See alsodirname.
Base.Filesystem.isabspath —Functionisabspath(path::AbstractString) -> BoolDetermine whether a path is absolute (begins at the root directory).
Examples
julia> isabspath("/home")truejulia> isabspath("home")falsesourceBase.Filesystem.isdirpath —Functionisdirpath(path::AbstractString) -> BoolDetermine whether a path refers to a directory (for example, ends with a path separator).
Examples
julia> isdirpath("/home")falsejulia> isdirpath("/home/")truesourceBase.Filesystem.joinpath —Functionjoinpath(parts::AbstractString...) -> Stringjoinpath(parts::Vector{AbstractString}) -> Stringjoinpath(parts::Tuple{AbstractString}) -> StringJoin path components into a full path. If some argument is an absolute path or (on Windows) has a drive specification that doesn't match the drive computed for the join of the preceding paths, then prior components are dropped.
Note on Windows since there is a current directory for each drive,joinpath("c:", "foo") represents a path relative to the current directory on drive "c:" so this is equal to "c:foo", not "c:\foo". Furthermore,joinpath treats this as a non-absolute path and ignores the drive letter casing, hencejoinpath("C:\A","c:b") = "C:\A\b".
Examples
julia> joinpath("/home/myuser", "example.jl")"/home/myuser/example.jl"julia> joinpath(["/home/myuser", "example.jl"])"/home/myuser/example.jl"sourceBase.Filesystem.abspath —Functionabspath(path::AbstractString, paths::AbstractString...) -> StringConvert a set of paths to an absolute path by joining them together and adding the current directory if necessary. Equivalent toabspath(joinpath(path, paths...)).
abspath(path::AbstractString) -> StringConvert a path to an absolute path by adding the current directory if necessary. Also normalizes the path as innormpath.
Examples
If you are in a directory calledJuliaExample and the data you are using is two levels up relative to theJuliaExample directory, you could write:
abspath("../../data")Which gives a path like"/home/JuliaUser/data/".
See alsojoinpath,pwd,expanduser.
Base.Filesystem.normpath —Functionnormpath(path::AbstractString, paths::AbstractString...) -> StringConvert a set of paths to a normalized path by joining them together and removing "." and ".." entries. Equivalent tonormpath(joinpath(path, paths...)).
normpath(path::AbstractString) -> StringNormalize a path, removing "." and ".." entries and changing "/" to the canonical path separator for the system.
Examples
julia> normpath("/home/myuser/../example.jl")"/home/example.jl"julia> normpath("Documents/Julia") == joinpath("Documents", "Julia")truesourceBase.Filesystem.realpath —Functionrealpath(path::AbstractString) -> StringCanonicalize a path by expanding symbolic links and removing "." and ".." entries. On case-insensitive case-preserving filesystems (typically Mac and Windows), the filesystem's stored case for the path is returned.
(This function throws an exception ifpath does not exist in the filesystem.)
Base.Filesystem.relpath —Functionrelpath(path::AbstractString, startpath::AbstractString = ".") -> StringReturn a relative filepath topath either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the existence or nature ofpath orstartpath.
On Windows, case sensitivity is applied to every part of the path except drive letters. Ifpath andstartpath refer to different drives, the absolute path ofpath is returned.
Base.Filesystem.expanduser —Functionexpanduser(path::AbstractString) -> AbstractStringOn Unix systems, replace a tilde character at the start of a path with the current user's home directory.
See also:contractuser.
Base.Filesystem.contractuser —Functioncontractuser(path::AbstractString) -> AbstractStringOn Unix systems, if the path starts withhomedir(), replace it with a tilde character.
See also:expanduser.
Base.Filesystem.samefile —Functionsamefile(path_a, path_b)Check if the pathspath_a andpath_b refer to the same existing file or directory.
Base.Filesystem.splitdir —Functionsplitdir(path::AbstractString) -> (AbstractString, AbstractString)Split a path into a tuple of the directory name and file name.
Examples
julia> splitdir("/home/myuser")("/home", "myuser")sourceBase.Filesystem.splitdrive —Functionsplitdrive(path::AbstractString) -> (AbstractString, AbstractString)On Windows, split a path into the drive letter part and the path part. On Unix systems, the first component is always the empty string.
sourceBase.Filesystem.splitext —Functionsplitext(path::AbstractString) -> (String, String)If the last component of a path contains one or more dots, split the path into everything before the last dot and everything including and after the dot. Otherwise, return a tuple of the argument unmodified and the empty string. "splitext" is short for "split extension".
Examples
julia> splitext("/home/myuser/example.jl")("/home/myuser/example", ".jl")julia> splitext("/home/myuser/example.tar.gz")("/home/myuser/example.tar", ".gz")julia> splitext("/home/my.user/example")("/home/my.user/example", "")sourceBase.Filesystem.splitpath —Functionsplitpath(path::AbstractString) -> Vector{String}Split a file path into all its path components. This is the opposite ofjoinpath. Returns an array of substrings, one for each directory or file in the path, including the root directory if present.
Examples
julia> splitpath("/home/myuser/example.jl")4-element Vector{String}: "/" "home" "myuser" "example.jl"sourceSettings
This document was generated withDocumenter.jl version 1.16.0 onThursday 20 November 2025. Using Julia version 1.12.2.