lua判断目录存在,创建目录

判断目录或文件是否存在

function file_exists(path)
  local file = io.open(path, "rb")
  if file then file:close() end
  return file ~= nil
end

创建目录

os.execute("mkdir ooxx\\ooxx\\ooxx\\ooxx) --windows
os.execute("mkdir -p ooxx/ooxx/ooxx) --unix,linux like

猜你喜欢

转载自blog.csdn.net/qf0129/article/details/78135301