首页 > 解决方案 > Checking if a folder exists

问题描述

I am looking for a good way of checking whether a folder exists from within a Julia script. For now what I am doing is:

function dir_exists(dir)
  exists = true
  try
    readdir(dir)
  catch err
    exists = false
  end
  exists
end

but I was wonder if there's a way that doesn't rely on exception handling.

标签: filesystemsjulia

解决方案


您正在寻找的功能是isdir.


推荐阅读