Is there a simple way in Julia to check whether a file in the current working directory exists (something like test = os.path.isfile("foo.txt")
in Python or inquire(file = "foo.txt", exist = test)
in Fortran)?
Asked
Active
Viewed 1.8k times
1 Answers
59
Julia has the isfile()
function to test for a regular file:
julia> isfile("foo.txt")
false
shell> touch foo.txt
julia> isfile("foo.txt")
true
As the documentation:
Returns true if path (the parameter) is a regular file, false otherwise.
-
2So simple and convenient! – Leonidas Mar 11 '21 at 23:12