Reputation: 720
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)?
Upvotes: 36
Views: 21432
Reputation: 2300
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.
Upvotes: 64