Lua: how to create a folder


Method 1: use LuaFileSystem

require "lfs"
lfs.mkdir("/path/to/dir")

Method 2: use paths

require 'paths'
paths.mkdir('/path/to/dir')

Method 3:
Use Lua/APR

local apr = require 'apr'
apr.dir_make('/path/to/dir')

Method 4: use os.mkdir

os.mkdir(path)

Method 5: Not recommended

os.execute("mkdir " .. dirname)

Leave a Reply